- Generate 0 and 1 with 25% and 75% probability.

Given a function rand50() that returns 0 or 1 with equal probability, write a function that returns 1 with 75% probability and 0 with 25% probability using rand50() only.

Advertisements

Skip to content
# Bitwise Operations

- Generate 0 and 1 with 25% and 75% probability.

Given a function rand50() that returns 0 or 1 with equal probability, write a function that returns 1 with 75% probability and 0 with 25% probability using rand50() only.

Advertisements

%d bloggers like this: