Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

RE: Random number

by gronkulator (Sexton)
on Jul 10, 2000 at 17:36 UTC ( [id://21787]=note: print w/replies, xml ) Need Help??


in reply to Random number

Code to generate an unsigned random 16 bit integer:
my $randbits="";
open(URANDOM, "/dev/urandom") or die "Phooey: $!";
read(URANDOM, $randbits, 2);
close(URANDOM);
$rand=unpack("S*", $randbits);
printf("random: %d\n", $rand);
Divide by whatever to produce a random integer in a specific range.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://21787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (None)
    As of 2024-04-25 04:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found