CogUtil::RandGen
Inherits Reference < Object
High-quality random number generator based on Mersenne Twister Crystal's built-in Random class already uses a high-quality algorithm, so we wrap it with OpenCog-specific functionality
Constructors
new(seed : UInt32 | Nil = nil)
SourceClass methods
choose(array : Array(T)) : T forall T
Sourcerandbytes(size : Int32) : Bytes
Sourceranddouble(min : Float64, max : Float64) : Float64
Sourceranddouble(max : Float64) : Float64
Sourceranddouble
Sourcerandfloat(min : Float64, max : Float64) : Float64
Sourcerandfloat(max : Float64) : Float64
Sourcerandfloat
Sourcerandint(min : Int32, max : Int32) : Int32
Sourcerandint(max : Int32) : Int32
Sourcerandnormal(mean : Float64 = 0.0, stddev : Float64 = 1.0) : Float64
Sourcesample(array : Array(T), count : Int32) : Array(T) forall T
Sourceshuffle(array : Array(T)) : Array(T) forall T
Sourceshuffle!(array : Array(T)) : Array(T) forall T
SourceInstance methods
randdouble(min : Float64, max : Float64) : Float64
Sourceranddouble(max : Float64) : Float64
Sourcerandnormal(mean : Float64 = 0.0, stddev : Float64 = 1.0) : Float64
Generate random number from normal distribution Uses Box-Muller transform
sample(array : Array(T), count : Int32) : Array(T) forall T
Random sample from array without replacement