Rnd

Random number generator

Constructors

ConstructorDescription
new()
Signature: unit -> Rnd

Static members

Static memberDescription
Choice(a, probs)
Signature: (a:'a [] * probs:DV) -> 'a
Type parameters: 'a

Select a random element of array a, given selection probabilities in vector probs

Choice(a, probs)
Signature: (a:'?109143 [] * probs:float32 []) -> '?109143
Type parameters: '?109143

Select a random element of array a, given selection probabilities in array probs

Choice(a)
Signature: (a:'?109141 []) -> '?109141
Type parameters: '?109141

Select a random element of array a

Normal(mu, sigma)
Signature: (mu:float32 * sigma:float32) -> float32

Sample a float32 from the normal distribution with given mean mu and standard deviation sigma. X ~ N(mu,sigma)

Normal()
Signature: unit -> float32

Sample a float32 from the standard normal distribution. X ~ N(0,1)

NormalD(mu, sigma)
Signature: (mu:D * sigma:D) -> D

Sample a D from the normal distribution with given mean mu and standard deviation sigma. X ~ N(mu,sigma)

NormalD()
Signature: unit -> D

Sample a D from the standard normal distribution. X ~ N(0,1)

NormalDM(m, n, mu, sigma)
Signature: (m:int * n:int * mu:D * sigma:D) -> DM

Sample a DM of m rows and n columns from the normal distribution with given mean mu and standard deviation sigma. Elements of matrix X ~ N(mu,sigma)

NormalDM(m, n)
Signature: (m:int * n:int) -> DM

Sample a DM of m rows and n columns from the standard normal distribution. Elements of matrix X ~ N(0,1)

NormalDV(n, mu, sigma)
Signature: (n:int * mu:D * sigma:D) -> DV

Sample a DV of length n from the normal distribution with given mean mu and standard deviation sigma. Elements of vector X ~ N(mu,sigma)

NormalDV(n)
Signature: n:int -> DV

Sample a DV of length n from the standard normal distribution. Elements of vector X ~ N(0,1)

Permutation(n)
Signature: n:int -> int []

Generate a random permutation of a set of length n

Seed(seed)
Signature: seed:int -> unit

Seed the random number generator with integer seed

Uniform(min, max)
Signature: (min:float32 * max:float32) -> float32

Sample a float32 from the uniform distribution between min and max. X ~ U(min,max)

Uniform(max)
Signature: max:float32 -> float32

Sample a float32 from the uniform distribution between zero and max. X ~ U(0,max)

Uniform()
Signature: unit -> float32

Sample a float32 from the standard uniform distribution. X ~ U(0,1)

UniformD(min, max)
Signature: (min:D * max:D) -> D

Sample a D from the uniform distribution between min and max. X ~ U(min,max)

UniformD(max)
Signature: max:D -> D

Sample a D from the unifrom distribution between zero and max. X ~ U(0,max)

UniformD()
Signature: unit -> D

Sample a D from the standard uniform distribution. X ~ U(0,1)

UniformDM(m, n, min, max)
Signature: (m:int * n:int * min:D * max:D) -> DM

Sample a DM of m rows and n columns from the uniform distribution between min and max. Elements of matrix X ~ U(min,max)

UniformDM(m, n, max)
Signature: (m:int * n:int * max:D) -> DM

Sample a DM of m rows and n columns from the uniform distribution between zero and max. Elements of matrix X ~ U(0,max)

UniformDM(m, n)
Signature: (m:int * n:int) -> DM

Sample a DM of m rows and n columns from the standard uniform distribution. Elements of matrix X ~ U(0,1)

UniformDV(n, min, max)
Signature: (n:int * min:D * max:D) -> DV

Sample a DV of length n from the uniform distribution between min and max. Elements of vector X ~ U(min,max)

UniformDV(n, max)
Signature: (n:int * max:D) -> DV

Sample a DV of length n from the uniform distribution between zero and max. Elements of vector X ~ U(0,max)

UniformDV(n)
Signature: n:int -> DV

Sample a DV of length n from the standard uniform distribution. Elements of vector X ~ U(0,1)

UniformInt(min, max)
Signature: (min:int * max:int) -> int

Sample a random integer between min and max

UniformInt(max)
Signature: max:int -> int

Sample a non-negative random integer less than max

UniformInt()
Signature: unit -> int

Sample a non-negative random integer