Embed the Random Number Generator
Put a free random number generator on your own page with one line of HTML, or draw numbers in your own code with a tiny script. There is no account and no key. Every number is drawn with your visitor’s own browser’s secure random number generator, with no modulo bias.
The widget
Paste this where you want the generator to appear:
<div data-randomfella-number data-min="1" data-max="100" data-count="1" data-theme="inherit"></div> <script src="https://randomfella.com/random-number-generator/embed.js" async></script>
It is a responsive frame with a transparent background. It keeps nothing: no settings, no history and no cookies of its own. A small “Randomfella” link under it points back here.
Options
| Attribute | Meaning |
|---|---|
data-min, data-max | The range, whole numbers from −1,000,000,000 to 1,000,000,000 (default 1 to 100). |
data-count | How many numbers per press, 1 to 100. |
data-unique | true or false: whether a number may repeat within one draw. |
data-decimals | Decimal places, 0 to 4. |
data-theme | light, dark or inherit (matches the colour behind it). |
data-height | Starting height in pixels; it resizes itself to fit. |
From JavaScript
const gen = RandomfellaNumber.create("#here", { min: 1, max: 50, count: 5, unique: true, theme: "dark" });
gen.on("generate", (m) => console.log(m.numbers, m.min, m.max));
gen.generate(); // draw now
gen.setRange(10, 20); // change the range
gen.setCount(3); // change how many
Each generate message carries numbers (an array), min, max, decimals, unique, count and a timestamp. There is no way to set a seed or to supply the numbers from outside: only the generator draws them.
The SDK
For code that needs numbers without a screen. It has no dependencies, uses Web Crypto, and throws if Web Crypto is missing instead of falling back to something weaker. It has no seeded or repeatable mode.
<script type="module">
import { generate } from "https://randomfella.com/random-number-generator/sdk/randomfella-number-sdk.esm.js";
generate({ min: 1, max: 100 }); // 42
generate({ min: 1, max: 49, count: 6, unique: true }); // [3, 17, 22, 31, 40, 48]
generate({ min: 0, max: 1, decimals: 2 }); // 0.37
</script>
A plain script version, randomfella-number-sdk.umd.js, exposes RandomfellaNumberSDK.generate. Options: min, max, count, unique, decimals, exclude (an array), parity ("even" or "odd"), multiple and sort ("asc" or "desc"). Impossible requests throw a RangeError that says why.
Good to know
- The widget and SDK are free to use on any site, with or without a link back.
- Results are never sent to Randomfella. The page counts anonymous presses of Generate, never the numbers.
- Prefer to link instead? The full generator is here, and you can start it with a range in the address, for example
?min=1&max=10.
All Randomfella tools · Flip a Coin · Roll a Dice · Spin the Wheel