About Me

Saturday, July 16, 2011

You are provided with a bit generator which generates 1 and 0 with equal probabilities i.e. (1/2). You are required to design a function which generates numbers form 1-1000 with equal probabilities i.e. (1/1000).

1 comment:

  1. 10 bits required to represent number from 1 to 1000.

    So use bit generator 10 times and form a number. if its greater than 1k than ignore the number and recalculate the number.

    This forms the uniform distribution, not skewed since we are neglecting the number from 1001 to 1023

    ReplyDelete

Hi thanks , we will get back to you shortly !!!