in reply to Re: Random numbers generation
in thread Random numbers generation
rand Returns a random fractional number greater than or equal to 0 and less than the value of EXPR.
int Returns the integer portion of EXPR. If EXPR is omitted, uses $_. You should not use this function for rounding: one because it trun-cates towards 0, and two because machine representations of floating point numbers can sometimes produce counterintuitive results.
rand(250) will always return a number less than 250 and int will never round up.
use rand(251)
perl -e"\$_=qq/nwdd\x7F^n\x7Flm{{llql0}qs\x14/;s/./chr(ord$&^30)/ge;print"
|
|---|