Leetcode Daily Question
2.46K subscribers
517 files
2.16K links
Why are you asking me to do Leetcode for this CSS job?
Download Telegram
Leetcode-cn.com 2021-09-05
🟡 470.implement-rand10-using-rand7

🏷️ Tags
#math #rejection_sampling #probability_and_statistics #randomized

Description
已有方法 rand7 可生成 1 到 7 范围内的均匀随机整数,试写一个方法 rand10 生成 1 到 10 范围内的均匀随机整数。

不要使用系统的 Math.random() 方法。




Example
输入: 1
输出: [7]