generate 1000000 random numbers
generate 1000000 random numbers
I'm not sure how I should write this in C++ in order to generate 1000000 numbers because my
professor said that rand() will not work. Does anyone know how to do this?
Thanks!
1 Nov 07, 9:43AM
There are two problem with rand():
- first is that it isn't a particularly good uniform random generator. You can see this if you generate a large set of numbers and produce a histogram. You should find you have a near straight line, with numbers in all ranges occurring equally.
- second the repeat period of the rand() isn't as height as some other generators. In otherwords if you try to produce a sufficiently long sequence of random numbers, you eventually reach a point when the sequence is identical to something produced earlier.
Login