altenbach wrote:Do these bits arrive constantly, one at a time? Does the ratio need to be exactly 0.5 or just a 50% probability to flip any given bit. What if the given ratio results in a non-integer number of bits? If you just want to have a certain probability, use the dice and see if the value is >0.5 to decide if to flip or not.
Please provide significantly more information. For example, what is the datatype of these "bits"?
(To process a given series of bits, you could use the bernoulli noise to generate a 0,1 array of the same lenght and with the desired ones probability. Flip all bits where the output is 1, for example).
dear thank you for replay i will give here more information about the case
1- the length of bits is constant and its privousllly known 10 or 20 ....etc.
2- each bit is generated in discrtete manner (generated serilaay ) each bit will generated at each while loop itration.
3 - datatype of these "bits" are just boolean bits
4- the ratio is not dice or anything. Its repersent the nummber of bits that must be flliped
for ex if bits length =10 and 0.4 ratio its mean that 4 (10*0.4) bits only will flipped
if ratio 0.9 then 9 bits from 10 will be fliiped
its simple idea but hard to implement