How this random number generator works
The tool accepts whole-number endpoints and treats both the minimum and maximum as eligible results. For a range from 1 through 100, there are 100 possible values. It requests random values from the Web Crypto API in your browser and maps them into the selected interval with rejection sampling. Rejection sampling discards source values that would make some outcomes slightly more likely than others, then tries again.
Everything runs in the current browser tab. The entered range and generated list are not sent to TrendPromptLab. The tool allows up to 100 results at once and supports negative endpoints, zero and positive integers within JavaScript's safe-integer limit.
Generate with or without duplicates
| Setting | What it means | Example |
|---|---|---|
| Duplicates allowed | Each draw is independent, so the same value may appear more than once. | Five draws from 1–3 could produce 2, 1, 2, 3, 2. |
| No duplicate numbers | Each selected value is removed from the available pool for that list. | Three draws from 1–3 will contain 1, 2 and 3 in a random order. |
| Inclusive endpoints | The minimum and maximum can both be selected. | A range of 0–1 can return either 0 or 1. |
When unique mode is on, the requested count cannot exceed the size of the range. For example, a 10–15 range contains six possible integers, so a request for seven unique results is impossible. The tool reports that conflict instead of silently changing the range or allowing a duplicate.
Practical examples
Pick a giveaway winner
Assign each valid entry a stable number, set the same minimum and maximum, and generate one result. Preserve the final entry list and selection result if the draw needs an audit trail. This page does not store a seed or create a verifiable public draw record.
Create test data
Generate several values inside the exact boundary your form or program accepts. Turn duplicates on when repeated values are realistic; turn them off when you need distinct IDs for a temporary test. Generated numbers are not guaranteed to be absent from an external database.
Choose samples without replacement
Use unique mode when selecting positions from a numbered population and each position may be chosen only once. A random selection does not automatically make the underlying population representative: missing, duplicated or biased source records can still bias the sample.
Limits and appropriate use
- The result is suitable for ordinary games, classroom activities, randomized ordering and software testing.
- Do not use it as a regulated lottery, casino, legal drawing or independently auditable election system.
- Do not use generated numbers directly as passwords, recovery codes, encryption keys or permanent security tokens; use a purpose-built security system that defines the required format and storage.
- Copying the result does not preserve the settings, draw time or proof of how the list was created.
Frequently asked questions
Are the minimum and maximum included?
Yes. Entering 1 and 10 makes every whole number from 1 through 10 eligible.
Why can a number appear twice?
Repeated values are expected when duplicates are allowed because each draw is independent. Select No duplicate numbers if each value should appear at most once in the generated list.
Is this the same as Math.random()?
No. This implementation uses crypto.getRandomValues(), which the Web Crypto specification defines as a source of cryptographically strong random values. The range conversion also rejects values that would introduce modulo bias.
Can I reproduce the same list later?
No. The generator does not accept or store a seed. Copy the list immediately if you need to keep it.
Primary references
- MDN Web Docs: Crypto.getRandomValues() — browser behavior, supported typed arrays and security characteristics.
- W3C Web Cryptography API — normative definition of the random-value method.