Speed is not the only problem when you generate random data, you really want the data to be random, you don’t want your experiment to suffer from duplicate data or other problems with a pseudo-random generator. If you need speed more and then randomness, you can always use a function like this , which will be very fast! </joke> .
Here's a message from Barry Kelly about a stack overflow describing possible problems with the built-in random number generator. Not going to bring it here, go read it for yourself, this is good stuff.
To conclude, when I needed a PRNG sufficient to generate a huge amount of random data, I used the Mersenne Twister (wikipedia link) sown by Delphi PRNG.
Quote from Wikipedia about Mersen Twister:
For many applications, Mersenne twister quickly becomes a pseudo-random number generator. Mersenne Twister is designed using simulation in Monte Carlo and other statistical simulators. Researchers primarily want high quality, but can also take advantage of their speed and portability.
And in order to break all my records by the number of links per post, I used this implementation of Delphi .
And my last thought: if you are not very good at math, stay away from your own PRNG implementations. Like hash functions, it's easy to make mistakes, and it's very difficult to parse them.
Edit
Was there any kind of timing using the following code. 10,000,000 records took 1,480 ms to create using the Mersenne Twister. The same code, using Delphi, built in a random number generator, took only 250 ms, for the same 10M records. Something tells me that this is not a random generator that needs to be optimized, but something else in the code.
procedure TForm1.Button1Click(Sender: TObject); var InitArray:array[0..99] of LongInt; i, N:Integer; TSR: TSignalRecord; CStart, CStop: Int64; begin Randomize; for i:=0 to 99 do InitArray[i] := Random($effffff); InitMTbyArray(InitArray, Length(InitArray)); CStart := GetTickCount; for i:=1 to 10000000 do begin TSR.signal1 := IRanMT; TSR.signal2 := IRanMT; TSR.signal3 := IRanMT; TSR.signal4 := IRanMT; TSR.signal5 := IRanMT; TSR.signal6 := IRanMT; N := IRanMT; TSR.bsignal1 := (N and 1) <> 0; TSR.bsignal2 := (N and 2) <> 0; TSR.bsignal3 := (N and 4) <> 0; TSR.bsignal4 := (N and 8) <> 0; TSR.bsignal5 := (N and 16) <> 0; TSR.bsignal6 := (N and 32) <> 0; end; CStop := GetTickCount; Caption := IntToStr(CStop - CStart); end;