How you chose from the wide array of pseudo-random generators available depends a lot on how you intend to use it. If you just need something that seems random in a video game, a LCG is probably fine. However, you could fill a large bookshelf with studies which were invalidated because they used randu for simulation. If you need good statistical properties for Monte Carlo simulation, don't use a LCG. Use a 64-bit multiply with carry as a minimum, and preferably use Mersenne Twister.
George Marsaglia developed a very comprehensive set of tests of the quality of a stream of "random" data. The suite is called "Diehard". It measures statistical properties of a sample and determines if it varies too much from what would be expected of a truly uniform and random sample. Many LCG generators fail badly. If you are using the generator for simulation you also need to be aware of the generator's period. If you exhaust the period, you are re- using data, which defeats the purpose of Monte Carlo simulation. There are hardware devices which claim to produce true random output, usually based on some sort of noisy physical process. They are generally slower than Mersenne Twister or other deterministic methods. However, they tend to have bias or other issues. If you need to generate an integer in a certain range, don't just use mod n. That does not result in a uniform result unless n is divisible by the range of the generator. You need to use a rejection method. Don On Oct 25, 8:44 am, Saurabh Kumar <[email protected]> wrote: > Take a look at Linear Congruential > Generator<http://en.wikipedia.org/wiki/Linear_congruential_generator> > algorithm > for generating pseudo random numbers. > > On 25 October 2012 16:58, bharat b <[email protected]> wrote: > > > > > > > > > I heard that LINUX uses our past time mouse movement and keys pressed at > > time and something else to generate a random number. > > > On Thu, Oct 25, 2012 at 4:07 PM, Anuj Khandelwal < > > [email protected]> wrote: > > >> hey all, > >> Any idea to generate random number without using rand() function call ? > >> Any algorithms for random number generation ? > > >> -- > >> Anuj Khandelwal > >> Final Year Undergraduate Student > >> Department of Computer Engineering > >> Malaviya National Institute of Technology, Jaipur > >> India > >> +91-9784678325 > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> For more options, visit this group at > >>http://groups.google.com/group/algogeeks?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
