Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

(tye)Re2: Generating Random Integers

by tye (Sage)
on Jan 03, 2001 at 21:34 UTC ( #49564=note: print w/replies, xml ) Need Help??


in reply to (fongsaiyuk)Re: (tye)Re: Generating Random Integers
in thread Generating Random Integers

Yes, tilde zero (~0) is a bit-wise "not" of 0, that is, an integer with all bits set. So it gets interpretted as an unsigned value and tells rand() to give back a random pattern of bits (a random number between 0 and (~0)-1, inclusive).

Gee, I guess I should be using rand(1+~0) from now on. Oh well, that would only be a minor improvement. (:

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2019-09-18 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (219 votes). Check out past polls.

    Notices?