Learn R Programming

gmp (version 0.1)

gmp.rand: Generate a random number

Description

Generate a uniformly distributed random number in the range 0 to $2^n -1$, inclusive.

If seed is precise, a new seed is initialised.

Usage

gmp.rand(n, seed = 0)

Arguments

n
Integer
seed
Integer

Value

  • A number.

References

mpz_urandomb from Gnu MP Library see http://swox.com/gmp

Examples

Run this code
# Integers are differents
gmp.rand(123)
gmp.rand(123)
gmp.rand(123)
# Integers are the same
gmp.rand(123,seed="234234234324323")
gmp.rand(123,seed="234234234324323")

Run the code above in your browser using DataLab