srand

srand

srand EXPR

srand

Sets and returns the random number seed for the rand operator-

The point of the function is to .html?lang=en"seed" the rand function so that rand can produce a different sequence each time you run your program- When called with a parameter, srand uses that for the seed; otherwise it (semi-)randomly chooses a seed. In either case, starting with Perl 5.14, it returns the seed. To signal that your code will work only on Perls of a recent vintage:

use 5.014;	# so srand returns the seed

If 登录查看完整内容