Updated 2017-06-08 05:42:02 by dbohdan

Purpose: Help with the math function rand.

srand(arg)

The arg, which must be an integer, is used to reset the seed for the random number generator. Returns the first random number from that seed. Each interpreter has its own seed.

The rand() and srand() functions are not cryptographically secure, and must not be used to generate one-time passwords or session keys. They are also probably not strong enough for Monte-Carlo simulation usage.

Discussion  edit

Q: I didn't find an srand section n man page - where does it come from? Is it a spec for a function that is missing? Is it part of an existing package? If so, what package - and can we have a URL to its man page?

A: As for Tcl 8.6 you can read about srand at https://www.tcl.tk/man/tcl8.6/TclCmd/mathfunc.htm or on the "mathfunc" man page (man n mathfunc).