Random Number Generator

Random integers in a range, with or without repeats.

Overview

Generates cryptographically unbiased random numbers, rolls virtual dice, picks lottery integers, and shuffles lists using the Web Crypto API.

Formula & Calculation Method

Random_Integer = Min + Math.floor((Crypto_Random_Uint32 / 4294967296) × (Max - Min + 1))

Eliminates modulo bias by sampling directly from the browser's hardware-seeded cryptographic random byte stream.

Worked Example: Rolling a Fair 6-Sided Die

Inputs: Min = 1 | Max = 6 | Quantity = 1 | Allow Duplicates = Yes

  • Sample 32-bit unsigned random integer via crypto.getRandomValues().
  • Normalize to uniform distribution scale between 1 and 6.
  • Output: 4

Summary: Range = [1, 6] | Generated Value = 4 | Distribution = Cryptographically Unbiased

Common Use Cases

  • Contest & Giveaway Winner Selection: Conduct transparent, provably fair prize draws and giveaways.
  • Tabletop Gaming & Dice Rolling: Roll polyhedral RPG dice (d6, d20, d100) for board games and roleplaying.
  • Statistical Sampling: Select randomized control group sample indices from larger population lists.

Frequently Asked Questions

What is modulo bias in random number generation?

An error where dividing by a range that doesn't evenly divide the RNG's bit size causes smaller numbers to be selected slightly more often.

Are these random numbers fair for official contest draws?

Yes, because numbers are generated using the browser's native cryptographic hardware randomness API.

Can I generate unique non-repeating numbers?

Yes, toggle the 'No Duplicates' option to generate unique picks without replacement (like lottery draws).

Related Calculators & Tools