in reply to What is the limit of random number that can be selected

Yeah, it can:
perl -e 'foreach (1..20) {print rand(2**40)."\n";}' 652134293073.004 1052236192611.47 192842278698.137 607110319202.945 169022882701.082 527530860527.984 927864292758.34 1056669509421.09 334346614774.41 928276890176.75 1007499895313.79 947274310133.477 99715725600.9883 844160053849.766 826658965072.496 492702127712.117 518596741600.816 70972611711.0312 56473002822.4492 357827335249.008
Use the int function to get integers.

Replies are listed 'Best First'.
Re: Re: What is the limit of random number that can be selected
by TimToady (Parson) on Apr 23, 2004 at 21:09 UTC
    You have at least a 48-bit random number generator, so count yourself lucky. Even so, if you change your 40 to a 49, you might find that all twenty of your values are even numbers, as it is on my machine. So taking the number modulo a few billion leaves you with potential skewings of about one part in 65,000 or so. That's good enough for many, but not all, applications.