Question: Suppose that Bob wants a constant-time method for implementing the random(k) method, which returns a random integer in the range [0, k 1]. Bob

Suppose that Bob wants a constant-time method for implementing the random(k) method, which returns a random integer in the range [0, k − 1]. Bob has a source of unbiased bits, so to implement random(k), he samples [log k] of these bits, interprets them as an unsigned integer, K, and returns the value K mod k. Show that Bob’s algorithm does not return every integer in the range [0, k − 1] with equal probability.

Step by Step Solution

3.30 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Suppose we take k 10 Then before he performs his modular reductio... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures Algorithms Questions!