It's a common interview question to generate a larger range of random numbers using a random number generator for a smaller range. For example, given a function rand5
that randomly generates numbers from 0 to 5, create rand7
. There is a SO thread for that.
How do we do the opposite, create rand5
given rand7
?
Aucun commentaire:
Enregistrer un commentaire