Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crappy Random Number Generator

This may sound like an odd question, but where can I find a random number generator that works in C or C++ that is not very good?

Context: I'm creating some tree graph plotting software and testing it by using multi-digit random numbers (so each digit becomes a node in the tree). The random number generator I've been using - which is the one that comes with the GNU C++ compiler - gives me a nice spread of values. That's good, but I want to see how the table looks when the numbers clump together and are less homogenous.

Can anyone suggest a random number generator that has been proven to be not-so-random?

(Oh, any anyone who links to xkcd and/or suggests I just return 4 will get sarcasm in response).

like image 399
thornate Avatar asked Oct 08 '09 04:10

thornate


People also ask

Why is the RANDU pseudo random number generator unacceptable?

The RANDU linear congruential uniform random number generator was used in the 1960s. It has become infamous because when generated uniform values are used three at a time in a 3-tuple (tuplet), the generator is biased.

What is RANDus?

RANDU is a linear congruential pseudorandom number generator (LCG) of the Park–Miller type, which was used primarily in the 1960s and 1970s.

Can a random number generator be manipulated?

With some random number generators, it's possible to select the seed carefully to manipulate the output. Sometimes this is easy to do. Sometimes it's hard but doable. Sometimes it's theoretically possible but practically impossible.

What is the difference between pseudo random numbers and quasi random numbers?

This approach avoids clustering and can speed up convergence, but quasirandom numbers are generally too uniform to pass randomness tests. Pseudorandom numbers are less uniform than quasirandom numbers and may be more appropriate for applications that require greater randomness.


1 Answers

I've always thought of randu as the godfather of bad random number generators.

like image 170
mob Avatar answered Sep 21 '22 12:09

mob