generate a huge amount of random numbers
- From: "Guenther Wimpassinger" <gw_spam@xxxxxxxxx>
- Date: Fri, 29 Apr 2005 11:00:33 +0200
How can I (or you) fasten up this procedure? The array has
40,000 elements.
//Fill an array of DWords where each bit is set randomly
//@param (BitsArray the array which have to be filled)
//@param (MaxProp defines the posibility for a bit to be set.
// for each Bit in the DWord := random < MaxProp
// range [0.0 .. 1.0] including)
procedure InitRandomBits(var BitsArray: array of DWord;
const MaxProp:Single);
var
i,j : Integer;
begin
for i := 0 to high(BitsArray) do
begin
BitsArray[i] := $00;
for j := 0 to 31 do
if random < MaxProp
then BitsArray[i] := BitsArray[i] or (1 shl j);
end;
end;
.
- Follow-Ups:
- Re: generate a huge amount of random numbers
- From: John Herbster
- Re: generate a huge amount of random numbers
- Prev by Date: Re: Fastcode CompareMem B&V 1.0
- Next by Date: Re: Fastcode MM Rule
- Previous by thread: Counting cycles
- Next by thread: Re: generate a huge amount of random numbers
- Index(es):
Relevant Pages
|