rand Tcl Command


NAME

rand - random number generator

SYNOPSIS

::dmh::rand ?maximum?

DESCRIPTION

This command returns a random number that is uniformily distributed between 0 and maximum. The argument maximum defaults to 10000 but it can be set to floating point numbers such as 1.0.

The command sets and uses the ::dmh namespace variable random_seed. If you wish, you may initialize this value so that the generated sequence is not the same from program run to program run.

A high quality, linear congruential algorithm is used, based on Tom Swan's article in the January 1994 issue of Dr. Dobb's Journal.

AUTHOR

Ed Hume, Hume Integration Software

SEE ALSO

randnormal

KEYWORDS

random numbers, uniform distribution, statistics