srand#

Synopsis#

srand(42);             # deterministic sequence
srand;                 # seed from system entropy
my $seed = srand;      # returns the seed used

Description#

Seeds the pseudo-random number generator used by rand.

Sets the seed for the random number generator used by rand. If EXPR is provided and defined, its integer value is used. Otherwise, a system-derived seed (nanosecond timestamp XOR PID) is used. Creates a new StdRng instance via seed_from_u64. Returns the seed that was actually used as an integer.

See also#

rand