Customized probability function

Question

Given a function called random_5(), that returns an integer between 1 and 5 (inclusive) with uniform probability, implement a function that returns an integer from 1 to 7 (called random_7()) with uniform probability.

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now