Random Number Generator - Integers or Decimals in a Range
Draw 1–500 random integers or decimals with crypto.getRandomValues (Uint32), optional unique sampling, inclusive integer bounds. Not a certified lottery RNG.
Range and Options
Uses crypto.getRandomValues on a Uint32Array mapped into the range with rejection sampling. Not Math.random. Not a certified lottery or gambling RNG.
Generated List
What Is a Browser Random Number Generator and What It Is Not
A random number generator on this page draws integers or decimals inside a range you name, then lists them so you can copy a classroom sample, a shuffled subset, or a demo data set. The engine is the Web Crypto API: each draw fills a Uint32Array with crypto.getRandomValuesand maps that 32-bit integer into your range. It does not call Math.random().
That distinction matters for honesty more than for homework.Math.random is a fast, non-cryptographic PRNG. Engines may change its algorithm; it is not specified as a CSPRNG. Web Crypto's getRandomValues is the browser's cryptographically strong source for the platform. Mapping Uint32 values with rejection sampling avoids the classic modulo bias that appears when you write x % (max - min + 1) on a range that does not divide 232.
It is still not a certified lottery machine, casino RNG, or legal raffle drum. No entropy audit, no gambling-commission certificate, no printed seed log lives here. Use it for unique-enough classroom tickets, practice data, and unbiased-looking samples in a bounded interval. Do not use it to pick lottery numbers you will cash, raffle winners you must defend in court, or gambling outcomes.
How to Generate a Random Integer Between 1 and 100 (or Any Inclusive Range)
- Set Min to 1 and Max to 100. Both ends are included for integers, so 1 and 100 can appear.
- Set Count from 1 to 500. Ten is a reasonable classroom handful; 500 is the hard cap.
- Leave Type on integers, or switch to decimals and pick 1–8 decimal places.
- Check Unique only if you want sampling without replacement. Click Generate - the list does not redraw on every keystroke.
- Copy the list or Clear the form. Range settings are remembered locally for up to 30 days.
Limits: count ≤ 500; integer min/max must be whole numbers; decimal bounds are rounded to the chosen places before sampling; unique mode errors if the discrete range is smaller than count; a single Uint32 cannot cover a span larger than 232 distinct slots.
Inclusive Max - Why a Die From 1 to 6 Must Be Able to Land on 6
Many programming APIs treat the upper bound as exclusive (Math.floor(Math.random() * n) yields 0 … n−1). People then write “random 1 to 6” and accidentally build 1 to 5. This generator treats integer Min and Max as inclusive. A range of 1 to 6 has six faces. A range of 1 to 100 has one hundred integers. That matches how students phrase the request: “pick a number from 1 to 100” includes 100.
Decimal mode rounds both bounds to the requested number of places, then samples the discrete grid of those decimals, including both endpoints after rounding. Min 0.10 and max 0.30 at 1 decimal place is the set {0.1, 0.2, 0.3}. If rounding would flip the order of the bounds, generation stops with an error instead of inventing an empty set.
Unique Numbers Without Replacement - And When the Range Is Too Small
Unchecked Unique is with replacement: each draw is independent, duplicates are allowed, a second 17 after a first 17 is a valid event. Checked Unique is without replacement: once a value is taken it cannot appear again in that batch. Drawing 5 unique integers from 1 to 10 is a combination-sized sample, not five independent rolls.
If Unique is on and the discrete range has fewer slots than Count, this page errors rather than repeating. You cannot draw 10 unique integers from 1 to 6. You cannot draw 5 unique 1-decimal values from 0.1 to 0.3 (only three grid points). Silent wrapping would look like a working unique mode and would be a lie.
Unique draws still use the same Uint32 mapping; the generator keeps sampling until it has Count distinct values (or fails the size check first). Order is the order values were accepted, not a sorted list - if you need a sorted unique sample, copy and sort it yourself, or feed the copied list into a sequence tool only after you decide it should be ordered.
Web Crypto getRandomValues vs Math.random - Mapping Uint32 Into a Range
Each uniform index in {0, 1, …, range−1} is produced by reading a 32-bit unsigned integer from crypto.getRandomValues, rejecting values in the incomplete last “bucket” of 232 that would bias smaller residues, then taking modulo the range size. Adding Min yields an inclusive integer. Decimal mode does the same on a scaled integer grid, then formats a fixed number of places.
Why not Math.random()? Because this page documents a CSPRNG on purpose. Homework that says “use a random integer” rarely needs cryptography, but a generator that pretends Math.random is “secure enough for tokens” teaches the wrong lesson. Web Crypto is the API browsers expose for that job. It is still software in your browser: if the environment is compromised, so is the draw. That is another reason this is not a lottery device.
For structured sequences that are the opposite of random - arithmetic or geometric terms - use the number sequence calculator. For a mean of a generated list, paste it into the average calculator. For general arithmetic after you copy numbers, the scientific calculator is the next step, not a second RNG.
Honest Limits - Not Lottery, Not Gambling, Not Infinite Precision
Count stops at 500 so a page cannot freeze on a million-line dump. Unique mode cannot invent extra distinct decimals beyond the grid. Integer bounds that are not integers are rejected in integer mode. Extremely wide integer spans that exceed 232 distinct values cannot be indexed by one Uint32. Floating-point Min/Max that cannot be represented exactly will round to the decimal grid; that is IEEE-754, not extra entropy.
Generation happens only when you click Generate. Changing Min after a list is sitting in the panel does not mutate that list. That is deliberate: a copied sample should not silently change while you edit the next experiment's bounds.
Privacy: draws never leave the machine. There is no server seed, no telemetry of results. After the script loads, Generate still works offline. Saved Min/Max/Count live in localStorage on this device for 30 days.
Rejection Sampling - What Gets Thrown Away and Why Modulo Bias Exists
A 32-bit unsigned integer has 4,294,967,296 possible values, 0 through 232 − 1. Suppose you want an integer from 1 to 6 (six faces). 4,294,967,296 is not a multiple of 6, so if you take x % 6 for every x, residues 0 and 1 appear slightly more often than 2, 3, 4, and 5. For a classroom die the bias is tiny. For a generator that advertises Web Crypto, leaving it in is sloppy. This page computes the largest multiple of the range size that still fits under 232 and redraws any Uint32 at or above that cutoff. Every surviving residue is then equally likely.
Redraws are rare for small ranges (a die almost never rejects). They become more noticeable only when the range size is a large fraction of 232. You do not pick the cutoff; the mapper does. Unique mode layers a set on top: it still draws unbiased indices, it just refuses to keep a duplicate until Count distinct values exist or the range is proven too small up front.
Classroom Draws, Shuffled Teams, and Why Generate Is a Button
Typical uses that match the tool: pick a random integer between 1 and 100 for a spinner-without-a-spinner; roll many inclusive 1–6 dice for a probability lab; sample 12 unique student IDs from 1–30 for a presentation order; generate decimal noise at 3 places between 0 and 1 for a scatter-plot demo. Click Generate once per experiment so the list you copy is a frozen sample. If the panel refreshed on every keystroke while you edited Max from 100 to 1000, you would never know which draw you documented.
What not to do: treat five unique integers as a lottery ticket, treat the CSPRNG label as a courtroom certificate, or assume two browsers on two phones produced independent entropy you can combine into a jackpot. Each Generate is one local draw. Copy the list into notes if you need a record; this site does not keep a history on a server because it never saw the numbers.
Decimal places 1–8 are a grid, not a continuum. “Random real in [0, 1]” is a different mathematical object (a uniform random variable on an interval). Here you get equally likely points on the rounded lattice. 8 decimal places is already 100 million slots per unit interval - plenty for a homework table, nowhere near an uncountable interval, and still bounded by Count ≤ 500 so the output stays readable.
Inclusive Ranges in Code vs This Generator - Off-by-One Traps
Languages disagree about interval notation. Python's random.randint(1, 100) is inclusive on both ends, matching this page. random.randrange(1, 100) excludes 100. Java's nextInt(100) yields 0 through 99. JavaScript tutorials that multiply Math.random() by 100 and floor it never produce 100 unless someone adds 1 with a fencepost that then produces 101. When a student says “random integer between 1 and 100” they almost always mean both 1 and 100 are legal. This generator follows that English, documents it, and still uses Web Crypto under the hood instead of the tutorial one-liner.
Count is independent of the range. Ten integers from 1 to 100 with replacement can repeat; ten unique integers from 1 to 100 cannot. Fifty unique integers from 1 to 40 is impossible and must fail. People also mix “give me numbers up to 100” with “give me 100 numbers.” Up to 100 is Max. 100 numbers is Count. Setting both to 100 with Unique on is a permutation of 1 through 100 in random order - a shuffle of the whole interval - which is allowed because the range size equals Count. Setting Count to 101 with Unique on is not.
Negative bounds are allowed when they are integers: Min −3 and Max 2 is six integers (−3, −2, −1, 0, 1, 2). Decimal mode with negative bounds works on the same rounded grid. Min greater than Max is always an error; the tool will not swap them silently, because a swapped range is a different experiment than a typo. Clear restores 1–100 and ten integers so you can return to the “between 1 and 100” demo without hunting defaults in a paragraph.
Security-adjacent uses (session IDs, tokens) need more than 500 small integers in a printed list. A visible list on a webpage is a terrible secret. Use Web Crypto yourself in application code for secrets; use this page for visible samples. The same API, different jobs. Documenting that split is the point of refusing a lottery certificate.
Frequently Asked Questions (FAQ) - Random Integers, Duplicates, and Web Crypto
How do I generate a random integer between 1 and 100?
Set Min to 1, Max to 100, Type to integers, and Count to how many numbers you want (1–500). Click Generate. Each integer is drawn from the inclusive range 1 through 100 using the Web Crypto API, not Math.random.
Can I generate random numbers with or without duplicates?
Yes. Leave Unique unchecked to sample with replacement (duplicates allowed). Check Unique to sample without replacement. If Unique is on and the range has fewer distinct values than Count, the generator stops with an error instead of silently repeating.
Why use crypto.getRandomValues instead of Math.random?
Math.random is a fast, non-cryptographic PRNG whose algorithm is not specified for cryptographic use. This tool fills a Uint32Array with crypto.getRandomValues (the Web Crypto CSPRNG) and maps those 32-bit values into your range with rejection sampling to avoid modulo bias.
Is the maximum value inclusive?
Yes for integers: Min and Max are both included. A range of 1 to 6 can produce 1 and 6, like a fair six-sided die. Decimal mode includes the endpoints after rounding to the requested number of decimal places.
Is this a certified lottery or gambling random number generator?
No. Numbers come from the browser's Web Crypto CSPRNG, which is appropriate for everyday unique IDs, classroom demos, and unbiased samples in a range. It is not a certified lottery machine, casino RNG, or legal drawing device. Do not use it to pick lottery tickets, raffle winners you must defend in court, or gambling outcomes.
Are random numbers generated locally in my browser?
Yes. Generation runs in your browser with the Web Crypto API. The numbers are not uploaded. After the page loads, Generate still works if the network drops. Inputs are saved only in localStorage on this device for up to 30 days.
Why Choose Our Random Number Generator?
- Web Crypto Uint32, not Math.random, with rejection sampling into the range.
- Inclusive integer max so 1–6 is a die and 1–100 includes 100.
- Unique constraint that errors when the range is too small, instead of repeating.
- Decimals with 1–8 places on a rounded grid.
- Generate on click, not on every keystroke.
- Honest: not lottery-certified. Private: local only.
Related Tools
Discover more free developer tools that might interest you.
Area Calculator
Calculate area of squares, rectangles, triangles, circles, and more
Use ToolAverage Calculator
Calculate mean, median, mode, and range from a list of numbers
Use ToolBasic Calculator
Add, subtract, multiply, and divide with a free online calculator
Use ToolBig Number Calculator
Add, subtract, multiply, and divide integers too large for a standard calculator
Use ToolBinary Calculator
Add, subtract, and convert binary numbers to decimal and hex
Use ToolCircle Calculator
Find radius, diameter, circumference, area, arc length, and sector area
Use Tool