Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by mitxela

4 days ago

Example: to get a number between 0-2 (3 values) with a 4-bit RNG (16 values, 0-15) you can split the set 0-14 into 3 groups of 5 (doesn't matter if you use modulus or divide) but if you get 15 you need to re-roll.

0 comments

mitxela

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities