Friday, June 3, 2016

algorithm - Expand a random range from 1–5 to 1–7

Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.




  1. What is a simple solution?

  2. What is an effective solution to reduce memory usage or run on a slower CPU?

No comments:

Post a Comment