Re: generate a huge amount of random numbers
- From: "John Herbster" <herb-sci1_AT_sbcglobal.net>
- Date: Fri, 29 Apr 2005 08:10:32 -0500
"Guenther Wimpassinger" <gw_spam@xxxxxxxxx> wrote
> Let's say, I have an array of bits. With the MaxProp parameter I
> can control how many bits of this array are set (approximately).
> So if I pass 1 as MaxProp all bits are set in this array,
> if I pass 0.5 nearly half of all the bits are set. So, the number
> of bits which should be set must be controllable.
Guenther, So you have 40,000 elements.
Are your "elements" bits or DWORDs?
Apparently MaxProp is the probably
that a bit value is set to 1.
And you are presently doing:
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;
You could fill your array with the required number
of one bit values and then do some shuffling of
both words, bytes, and bits. Regards, JohnH
.
- Follow-Ups:
- Re: generate a huge amount of random numbers
- From: Guenther Wimpassinger
- Re: generate a huge amount of random numbers
- References:
- generate a huge amount of random numbers
- From: Guenther Wimpassinger
- Re: generate a huge amount of random numbers
- From: John Herbster
- Re: generate a huge amount of random numbers
- From: Guenther Wimpassinger
- generate a huge amount of random numbers
- Prev by Date: Fastcode CompareMem B&V 1.1
- Next by Date: Re: generate a huge amount of random numbers
- Previous by thread: Re: generate a huge amount of random numbers
- Next by thread: Re: generate a huge amount of random numbers
- Index(es):
Relevant Pages
|