Re: generate a huge amount of random numbers




"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

.



Relevant Pages

  • Re: generate a huge amount of random numbers
    ... With the MaxProp parameter I ... >> can control how many bits of this array are set. ... > Guenther, So you have 40,000 elements. ...
    (borland.public.delphi.language.basm)
  • Re: Conversion Problem
    ... > ...talking about control arrays: ... > Why does a CommandButton have an Index even if it does ... just because it may or may not be part of an array. ... Because it's a hack. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Conversion Problem
    ... ...talking about control arrays: ... Why does a CommandButton have an Index even if it does not ... because it may or may not be part of an array. ... Now being able to attach any handler of any event as long as ...
    (microsoft.public.dotnet.languages.vb)
  • Re: global warming: is it us, or is it the sun?
    ... > structure (there is no such thing as a rigid structure on that scale) get ... if you use the whole array area as transmitting ... bit of control subsystems, etc. ... The power beam would be steered via coordinating the ...
    (sci.space.policy)
  • Re: IsCollection?
    ... whether or not a Control is a collection (or belongs to an array of ocntrols)? ... Text1.Count will give me the total elements of this control ... Now add a third command button to the form but DON'T make it part of the control array. ... If TypeOf Command1 Is Object Then ...
    (microsoft.public.vb.general.discussion)