Re: generate a huge amount of random numbers
- From: "Pierre le Riche" <pleriche@xxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 16:44:40 +0200
Hi Guenther,
>> 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
> Maybe thats an idea, I will use the weekend to think
> about it.
You could do what John suggested, and then randomly xor all the dwords with
values that have an equal number of 0 and 1 bits. By doing so you will not
change the number of 1 bits, but if your xor process is sufficiently random
you should get a reasonably random progression of 0's and 1's with the
number of 1 bits exactly matching your predefined probability.
The downsize is that your probability for a 1 can only be a multiple of
1/32.
Regards,
Pierre
.
- 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
- 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: Re: generate a huge amount of random numbers
- 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
|