Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: rand / srand

by GrandFather (Sage)
on Oct 24, 2006 at 07:45 UTC ( #580208=note: print w/replies, xml ) Need Help??


in reply to rand / srand

rand is generally the C standard library rand function which varys from C to C implementation. rand is a pseudo-random number generator and it does repeat its cycle after a period that is a function of the specific implementation.Even minimal implementations should use at least 16 bits with a cycle length of 64K.

Much better generators are available and there is a vast quantity of material available describing the virtues and failings of different generators. For your purpose how many numbers do you require? Do they need to be random (derived from a "random seed"). Do they need to be independent or can a random starting point be used in a very long sequence? How many do you need to generate per second?

Random_number_generator is a starting point for exploring the world of random number generators. You could look at Math::Random for a better pseudo random number generator.



DWIM is Perl's answer to Gödel

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://580208]
help
Chatterbox?
[choroba]: I don't see it when XP doesn't change either
[marinersk]: That has always been its behavior, but I'm a visual/spacial- awareness guy. When the node disappears, it messes with my head, even though it is on the right margin.
[marinersk]: I was hoping there was a way to turn it on and make it stay on.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2017-05-29 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?