class

Rand

Inherits Reference < Object

Constructors

new(seed : UInt64, sequence = 0_u64)

Initializes an instance with the given seed and sequence.

Source
new(random : Random)

Initializes an instance with the given random object.

Source
new

Initializes an instance with a random seed.

Source

Instance methods

randn(mean, std_dev) : Float64

Generates a random number from a normal distribution.

This method generates a random number from a normal distribution with a given mean and standard deviation std_dev.

r = Rand.new
r.randn(0, 1) # => 0.1.9288478880269821
Source
randn

Generates a random number from a standard normal distribution.

This method uses the Box-Muller transform to generate a random number from a standard normal distribution. The generated number will have a mean of 0 and a standard deviation of 1.

r = Rand.new
r.randn # => 0.1.9288478880269821
Source
random
Source

Macros

method_missing(call)
Source