Generate Unbiased Random Integers

What the Random Number Generator Does

From classroom seat picks and board game dice rolls to randomized A/B test groups and raffle ticket draws, simple JavaScript Math.random() implementations often introduce tiny modulo skew on ranges that do not evenly divide 2^32. The ToolNest Random Number Generator relies on crypto.getRandomValues() paired with rejection sampling so every whole integer inside your inclusive range is drawn with uniform probability—locally in your browser.

How to Use the Random Number Generator

  1. Enter your inclusive Minimum and Maximum whole integers (negative values such as -50 to 50 are supported).
  2. Set How Many Numbers you want to draw (from 1 to 100 numbers per batch).
  3. Enable Unique numbers for non-repeating draws or Sort results ascending for ordered lists, or click a quick preset like Coin Flip or 6-Sided Die.
  4. Click Generate Numbers to see results and summary statistics.

Unbiased Rejection Sampling Method

Rather than taking raw remainder modulo range directly, rejection sampling discards any 32-bit unsigned draw at or above the largest exact multiple:

Range = Max − Min + 1 Limit = floor(2^32 / Range) × Range Accept randomUint32 only if randomUint32 < Limit, then return Min + (randomUint32 mod Range)

3 Practical Examples

Frequently Asked Questions

How does ToolNest avoid modulo bias when picking random numbers?

It draws 32-bit integers via Web Crypto (crypto.getRandomValues) and applies rejection sampling above exact multiples of the range size.

Can I generate non-repeating unique numbers for raffles or giveaways?

Yes. Check Unique numbers so no value repeats inside a batch of up to 100 results.

Are Minimum and Maximum values inclusive?

Yes. Both Minimum and Maximum can be selected as outcomes, and negative bounds work cleanly.

Is this suitable for regulated commercial gambling or legal lotteries?

No. Regulated gaming or formal sweepstakes require externally audited and jurisdiction-certified randomizers.

What do the Coin Flip and Die presets do?

They populate 1–2, 1–6, or 1–100 and trigger an instant roll in one click.

Method and sources

Powered by the W3C Web Cryptography API (window.crypto.getRandomValues) with uniform rejection sampling.

Usage note: Intended for education, games, general sampling, and informal draws; not certified for regulated wagering or legal drawings.