What the random integer generator produces
The random integer generator returns whole numbers only: no fractions, no decimal places, just values such as -412, 0 or 87. Both bounds are included, so the default range of -1000 to 1000 holds 2,001 possible values. It shares its engine with the Random Number Generator, which starts at 1 to 100 and suits everyday picks such as raffles. Use this page when you care about how the integers behave: signed values, repeats, unique samples and test data. If your question is mainly about setting up a range correctly, the random integer range page covers inclusive bounds and off-by-one errors in code.
Uniform: every integer has the same chance
Each value is drawn with probability 1 / (Max − Min + 1). The generator reads 32-bit values from the browser's crypto.getRandomValues and throws away any value that would give some integers a slightly larger share, a technique called rejection sampling. For ranges wider than about four billion values, it combines two readings into a 53-bit number and applies the same rule. The result has no bias toward small numbers, no pattern you could predict from earlier output and no seed that repeats between visits.
Decimal bounds are rounded inward
If you type a bound with a fractional part, Min is rounded up and Max is rounded down, so the output never leaves the interval you entered. Real output for Min 1.5 and Max 6.5:
3 4 5 2 2 6 3 4 3 4Only 2 to 6 can appear. With Min 1.2 and Max 1.8 there is no integer in between, and the page reports Min must not be greater than max. If you actually want fractional values, use the Random Decimal Generator.
Repeats versus unique integers
With Unique values unticked, every draw is independent, so duplicates are expected. Here are twelve real values from 0 to 255:
245 70 200 95 102 115 207 248 119 154 202 207The value 207 appears twice. That is not a flaw: the chance of at least one repeat among k draws from N values is about 1 − e^(−k(k−1) / 2N), which for 12 draws from 256 values comes to roughly 23%. When you tick Unique values, a draw that repeats an earlier value is discarded and drawn again, which is equivalent to sampling without replacement. The count can then be no larger than the number of integers in the range; asking for more produces an error rather than a padded list.
Sampling and test data recipes
- Audit a sample of records: Min 1, Max 1200, How many 50, Unique values on, Sort ascending, Separator comma. Paste the result into a query such as
WHERE id IN (…). If some IDs have been deleted, sample row positions instead of IDs. - Exercise numeric fields: generate values across the full range of the column type, then add the boundary values yourself, since a random sample rarely hits the exact minimum or maximum.
- Byte-sized values: 0 to 255 gives random byte values you can convert with Decimal to Binary or Decimal to Hex.
- Statistics practice: generate 1,000 integers from 1 to 10 and compare their average with the expected 5.5. Small samples wander noticeably; larger ones settle close to the expected value.
| Integer type | Min | Max |
|---|---|---|
| 8-bit unsigned | 0 | 255 |
| 8-bit signed | -128 | 127 |
| 16-bit unsigned | 0 | 65535 |
| 16-bit signed | -32768 | 32767 |
| 32-bit unsigned | 0 | 4294967295 |
| 32-bit signed | -2147483648 | 2147483647 |
Limits and output
Each run produces 1 to 10,000 integers. The difference between Max and Min may be at most 9,007,199,254,740,991; wider ranges are refused with a message. On screen, every integer sits in its own box with a copy button. The Separator setting (new line, comma or space) decides how Copy all and Download join the list, and the sort option orders values numerically. Download saves a plain text file named random-integer-generator.txt. Changing any setting produces a new list straight away, and Ctrl/⌘ + Enter does the same from the keyboard. Everything is generated locally in your browser.
Random integer generator in Python
The random module covers every option on this page. random.randint(a, b) returns an integer with both ends included, exactly like the Min and Max fields above, while random.randrange(a, b) stops one short of b; mixing the two up is the usual off-by-one bug. For values without repeats use random.sample(), which raises ValueError when you ask for more integers than the range holds. The module is built for simulations and test data, so draw tokens and PINs from secrets instead.
import random
import secrets
print(random.randint(-1000, 1000)) # one integer, both ends included
print([random.randint(1, 6) for _ in range(10)]) # ten dice rolls, repeats allowed
print(random.sample(range(1, 50), k=6)) # six unique integers from 1 to 49
print(sorted(random.sample(range(-1000, 1001), k=10))) # unique and sorted
# randrange() leaves the upper bound out, like range()
print(random.randrange(0, 10)) # 0 to 9
# For tokens, PINs and anything security related
print(secrets.randbelow(1000) + 1) # 1 to 1000
random.seed(42) # same seed, same sequence
print(random.randint(1, 100))
When all you need is a list to paste into a spreadsheet or a test file, the generator on this page produces it without a script.