Random Number Generator Widget

Add a random number generator to your website. Set a minimum and maximum, how many numbers and how many decimal places, choose whether numbers may repeat, and draw a fair result with one click.

QR & Generators Generator Runs in your browser Free · no ads

Customize your widget

Theme
Auto follows the visitor's light/dark setting.
Style
Attribution on your page
Optional and entirely your choice. The exact line is shown in the code below; it links to the tool with rel="nofollow".
More options
Starting values
Leave blank to use the widget's defaults. Visitors can still change every value.

Live preview

Exactly what your visitors will see

Embed code

<iframe src="https://a2z.tools/embed/w/random-number-generator" title="Random Number Generator by A2Z Tools" width="100%" height="600" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>

A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.

Works with

How it works

The range is turned into a count of equal steps - whole numbers, or tenths, hundredths and so on when decimals are chosen - and each draw picks one step with the browser's cryptographic random generator. Rejection sampling removes the small bias that the common random-number-mod-range shortcut introduces, and ranges larger than four billion values combine two random words into 53 bits. With "No repeats" on, the widget shuffles when you ask for most of the range (for example a whole lottery draw) and otherwise redraws duplicates, so the result is still a uniform pick of distinct numbers.

Method

  • Steps: lo = ceil(min x 10^d), hi = floor(max x 10^d), n = hi - lo + 1; value = (lo + k) / 10^d
  • k uniform in [0, n): 32-bit word redrawn while >= 2^32 - (2^32 mod n); for n > 2^32 a 53-bit value redrawn while >= 2^53 - (2^53 mod n)
  • No repeats: partial Fisher-Yates shuffle when drawing more than half of a range up to 100,000 values, otherwise redraw duplicates
  • Limits: 1 to 500 numbers, 0 to 6 decimal places, bounds within +/- 10^15

Limitations

  • Only uniform draws: no weighted, normal (bell-curve) or other distributions.
  • Results are not seeded or logged, so a draw cannot be reproduced or audited afterwards; record public draws on video.
  • It is not a certified gaming or lottery random number generator and should not be used where regulation requires one.
  • Decimal draws are multiples of 10^-d between the bounds; a bound that is not such a multiple is moved inward to the nearest one.

Where publishers use it

  • Giveaway and contest pages picking a winning entry number in public
  • Teachers generating practice sums, seat numbers or random groups
  • Board-game, tabletop and dice-roll pages (1 to 6, 1 to 20 and so on)
  • Researchers and QA teams drawing random sample IDs from a numbered list

Questions

Is every number equally likely?

Yes. Draws use the browser's cryptographic generator with rejection sampling, so each possible value in the range has exactly the same chance - there is no bias towards low numbers.

Can it pick lottery-style numbers without repeats?

Yes. Turn on No repeats and, for example, draw 6 numbers from 1 to 49; choose Smallest first to sort them.

How do decimals work?

With 2 decimal places the numbers are multiples of 0.01 between your minimum and maximum, each equally likely, and always shown with two decimals.

Can the result be verified later?

No. The draw is not recorded anywhere, so for a public giveaway record the screen or draw live in front of participants.

Sources

  1. Web Cryptography API - Crypto.getRandomValues() - W3C . cryptographically secure random words behind every draw
  2. Algorithm 235: Random permutation (R. Durstenfeld, Communications of the ACM 7(7), 1964) - ACM . the in-place Fisher-Yates shuffle used for draws without repeats

Cite or recommend this tool

If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.

A2Z Tools Random Number Generator
https://a2z.tools/embed/random-number-generator

Preview