C++ Random # Generator ~U(0,1)

Joined
2/6/09
Messages
10
Points
11
I have just come across the "Random Number Generator" section of my C++ book. It seems a bit confusing to me though...

In JAVA the random numbers were always ~U(0,1). Here, it does not appear that way. I have also read multiple times that the rand() function in C++ is not a 'good' random number generator.

I am learning C++ so I can use it while getting my MFeng at Cornell this Fall. Will using rand() be okay for all intensive purposes???
 
There are a few threads on quantnet about this topic. Do a search. The standard C++ random number generator is reasonable if you want to play around but probably not for any serious work.

Also try reading about the Mersenne twister.

For Monte Carlo applications try reading about low-discrepancy sequences.
 
rand() is fine for learning. You probably want to abstract out the random number generation process so you can plug in one of the methods John mentioned or some other method altogether.
 
Back
Top Bottom