How to Generate a Random Number
By Tools Star Hub Editorial Team · Published
A random integer is a whole number from the minimum through the maximum, with both ends included. A decimal is a number in that same span, rounded to at most 6 decimal places.
Use a list when you need several draws. Unique mode only works for integers, and only when the range contains enough distinct values.
How to generate numbers
- Enter a minimum and a maximum. If the minimum is greater than the maximum, the page rejects the pair. Each bound must stay within ±1,000,000,000. A blank bound is rejected.
- Choose integer or decimal. Integer mode needs whole-number bounds.
- Enter how many values to generate. The count is from 1 to 200. A count of 0 is rejected.
- Turn on unique only for integers. Asking for 5 unique integers from 1 to 3 fails, because that range has only 3 values. Unique mode is not available for decimals.
- Generate. The values come from the browser’s crypto.getRandomValues, not from Math.random().
Example
A fixed integer
Minimum 5, maximum 5, count 3, integers, not unique: every value is 5.
Every integer in a short range
Minimum 1, maximum 3, count 3, unique integers: the list is 1, 2, and 3 in some order.
Things to watch
What this draw is not
The page does not draw from a physical die, and it does not store the list. A password belongs on the Password Generator. An identifier belongs on the UUID Generator.
FAQ
- Are the endpoints included?
- Yes. A range of 1 to 3 can return 1 and can return 3.
- Why was my unique request rejected?
- The count is larger than the number of distinct integers in the range, or you asked for unique decimals.
- What is the longest list?
- 200 numbers in one click.
- Is this a password?
- No. Use the Password Generator for a password and the UUID Generator for an identifier.
To draw 1 to 200 integers or decimals, use the Random Number Generator.