๐ฒ Random Number Generator 1-31
By Shihab Mia ยท Updated 2026-07-26
This is a free random number generator preset to the 1-31 range. A result is already showing above because it draws one number the moment the page loads, and you can click Generate for a fresh pick at any time. The range 1 to 31 matches the highest possible day count in a calendar month, which makes this preset handy for picking a random day, running a monthly draw, or settling anything with up to 31 options. Every value is drawn with your browser built-in cryptographic randomness, so all 31 numbers are equally likely.
What is the Random Number Generator 1-31?
The 1-31 preset simply locks the minimum at 1 and the maximum at 31, the same range as the days in the longest calendar months (January, March, May, July, August, October and December). That makes it a natural fit whenever you want to land on a random day without checking a calendar, whether that is picking a day to run an errand, choosing which day of the month a habit-tracking challenge starts, or assigning a random date for a low-stakes task. You can still edit the minimum and maximum boxes above if you want a different range; the 1-31 values are just the starting point.
Fairness comes from how the number is drawn, not just the range. The tool asks the Web Crypto API, the same cryptographically secure source browsers use for security features, for a 32-bit value and then applies rejection sampling before mapping it into 1 to 31. A naive approach would take that big number and reduce it with the remainder (modulo) operator, but 31 does not divide evenly into typical random ranges, so a plain modulo would make numbers 1 through a few of them very slightly more likely than the rest. Rejection sampling avoids this by throwing away the handful of raw values that would fall in that uneven leftover and redrawing, so all 31 outcomes end up with exactly the same probability.
The duplicates and sort options work the same way they do on the general-purpose generator, just applied to this smaller pool. With duplicates allowed, each of the numbers you request is picked independently, so asking for 5 numbers could return the same day more than once, similar to rolling a 31-sided die five times. Switch duplicates off and the tool instead shuffles the 31 possible values with a partial Fisher-Yates shuffle and hands you that many unique numbers in a row, so nothing repeats. Because there are only 31 distinct values, unique mode caps out at 31 numbers; ask for more than that without duplicates and the tool will tell you the range cannot supply them.
When to use it
- Picking a random day of the month for a task, reminder, or spot check without opening a calendar.
- Choosing the start day for a 31-day challenge, habit tracker, or monthly content calendar.
- Running a 31-sided decision, such as which of 31 entries, names, or options gets picked.
- Generating a quick sample date to test date-handling code or a calendar feature.
- Settling a low-stakes choice fairly when you have up to 31 items or people to choose from.
How to use the Random Number Generator 1-31
- The minimum and maximum are already set to 1 and 31, and a result is showing on load.
- Set how many numbers you want to generate.
- Tick Allow duplicates for independent picks, or untick it for unique numbers with no repeats.
- Optionally tick Sort results to list multiple numbers in ascending order.
- Click Generate for a fresh pick, then Copy to put the numbers on your clipboard.
Formula & method
Worked examples
Pick one random day of the month.
- Keep minimum at 1 and maximum at 31.
- Set how many to 1 and leave duplicates allowed.
- The draw treats all 31 possible days as equally likely.
Result: One number from 1 to 31, for example 17
Pick 4 unique numbers from a pool of 31 entries with no repeats.
- Keep minimum at 1 and maximum at 31.
- Set how many to 4 and untick Allow duplicates.
- The tool shuffles the 31 values and returns 4 distinct ones, so no entry is chosen twice.
Result: Four different numbers between 1 and 31, for example 3, 12, 19, 30
Nearby preset ranges and what they suit
| Range | Possible values | Typical use |
|---|---|---|
| 1 to 28 | 28 | A February-length pick, no leap day |
| 1 to 30 | 30 | A 30-day month, such as April or June |
| 1 to 31 | 31 | The longest calendar months and a general 31-item pick |
| 1 to 12 | 12 | Picking a month of the year |
How the duplicates toggle changes a 1-31 draw
| Setting | Method | Maximum numbers you can request |
|---|---|---|
| Allow duplicates on | Each pick is independent (with replacement) | No limit, repeats are possible |
| Allow duplicates off | Draw without replacement (shuffle) | Up to 31, since only 31 unique values exist |
Common mistakes to avoid
- Assuming 1-31 fits every month. Not every month has 31 days. If you are picking a real calendar date rather than just a number, remember that April, June, September and November stop at 30, and February stops at 28 or 29. Use this generator for the number itself, then check it fits the month you actually mean.
- Requesting more than 31 unique numbers. With duplicates off, the range can only supply 31 distinct values. Asking for 40 unique numbers between 1 and 31 is impossible; either lower the count to 31 or fewer, or allow duplicates.
- Forgetting both ends are included. The range is inclusive, so both 1 and 31 can appear, not just the numbers between them. That gives the full 31 possible outcomes, not 29.
- Reading too much into a short run. Genuine randomness is streaky. Generating a handful of numbers and seeing one value twice, or missing several values entirely, is normal and does not indicate bias. Fairness is a property of the long run, not of any single set of picks.
Glossary
- Random number generator (RNG)
- A process that produces numbers that are hard to predict, with each allowed value equally likely within the chosen range.
- Uniform distribution
- A spread where every value in the range, here all 31 of them, has exactly the same probability of being chosen.
- Rejection sampling
- A technique that discards the small uneven leftover of a random source before mapping it into a range, so the range does not get modulo bias.
- With and without replacement
- With replacement means each pick is independent and numbers can repeat. Without replacement means each of the 31 values is used at most once.
- Web Crypto API
- A built-in browser interface that supplies cryptographically secure randomness, the same quality of randomness browsers use for security features.
Frequently asked questions
Is a number already generated when the page loads?
Yes. The generator runs once automatically with the 1-31 range preset, so you see a result immediately. Click Generate whenever you want a new one.
How do I pick a random day of the month?
Leave the minimum and maximum at 1 and 31 and click Generate. The number you get can stand in for a day of the month; just confirm the month you have in mind actually has that many days.
Can I get random numbers from 1 to 31 without any repeats?
Yes. Untick Allow duplicates to draw unique numbers. Since there are only 31 possible values, you can request at most 31 unique numbers in one go.
Is this generator fair, or are some numbers more likely?
It is fair by design. The tool uses the Web Crypto API and rejection sampling to remove modulo bias, so each of the 31 possible values has exactly the same chance on every draw.
Can I change the range away from 1 to 31?
Yes. The 1-31 range is just the starting preset. Edit the minimum and maximum boxes above to pick any other whole-number range you need.
Does this tool store or send my results anywhere?
No. Every draw happens locally in your browser using JavaScript and the built-in crypto functions. Nothing is uploaded, logged, or sent over the network.