Random Number 1-12: How to Generate One

How-to basics · Updated November 23, 2026

Your random number between 1 and 12 is 7. This is a single, uniformly distributed pick from the integers 1 through 12, meaning every number in that range has an equal 1-in-12 (about 8.33%) chance of being selected. Below, you’ll find how such numbers are generated, how to choose a method that fits your need, and answers to common questions.

What “Random” Really Means Here

When you ask for a random number 1–12, you’re asking for a value from a discrete uniform distribution. In plain terms, each of the 12 outcomes is equally likely, and the result of one draw doesn’t affect the next. This is the same principle behind rolling a fair 12-sided die (a d12, used in tabletop games like Dungeons & Dragons).

True randomness is hard to achieve with everyday tools. A coin flip is binary, a six-sided die only gives 1–6, and a human picking a number is notoriously biased—people tend to choose 7 more often than other numbers when asked to “pick a number.” That’s why most practical methods rely on either physical randomness (like dice) or algorithmic randomness (like a computer’s random number generator).

Ways to Generate a Number 1–12

You have several options, each with trade-offs in convenience, fairness, and security.

  • Online random number generators (e.g., Random.org, Calculator.net): These use atmospheric noise or other physical sources to produce truly random numbers. They’re free, fast, and unbiased. Simply set the range to 1–12 and click generate.
  • Spreadsheet software (Excel, Google Sheets): Use =RANDBETWEEN(1,12) in Excel or Google Sheets. This returns a random integer in that range. Note: Excel’s RAND and RANDBETWEEN use a pseudo-random algorithm, not true randomness, but they’re fine for most non-cryptographic uses.
  • Programming languages: In Python, random.randint(1, 12); in JavaScript, Math.floor(Math.random() * 12) + 1. These are pseudo-random, seeded by the system clock or another source.
  • Physical dice: A 12-sided die (d12) gives an exact uniform distribution. Roll it once. If you only have a six-sided die, roll twice: first roll determines high (7–12) or low (1–6) (e.g., odd = low, even = high), second roll gives the exact number within that half. This gives a uniform 1–12.
  • Playing cards: Take 12 cards (Ace through Queen, or any 12 distinct cards), shuffle, and draw one. This works well if you need to avoid repeats in a sequence—just remove the drawn card and shuffle again.

For a single casual pick, any of these works. For repeated draws, make sure your method doesn’t introduce bias (e.g., re-rolling if you get a 13 on a d20 is fine, but discarding results can skew probabilities if done incorrectly).

How Computers Generate Random Numbers

Most software uses a pseudo-random number generator (PRNG). A PRNG is an algorithm that produces a sequence of numbers that appear random but are actually deterministic—given the same starting point (the “seed”), it produces the same sequence. Common PRNGs include the Mersenne Twister (used in Python and older Excel versions) and the xoshiro family. These are fast and pass many statistical tests for randomness, but they are not suitable for cryptography because an observer can eventually predict the sequence if they know the seed.

For truly unpredictable numbers, you need a cryptographically secure PRNG (CSPRNG) or a hardware random number generator. CSPRNGs use entropy from system events (like mouse movements or network traffic) to seed themselves. In programming, functions like crypto.getRandomValues() in JavaScript or secrets module in Python provide this. For a simple 1–12 pick, the difference rarely matters, but if you’re using the number for a lottery, drawing lots, or any security-sensitive application, use a CSPRNG.

How to Choose the Right Method

Consider your context:

  • Casual use (e.g., picking a month, a lottery number, a game outcome): Any method works. Online generators or spreadsheet functions are easiest.
  • Fairness in a group: If you’re dividing something among 12 people, use a method that’s verifiably unbiased, like a physical d12 or a trusted online generator. Avoid “pick a number” because human bias is real.
  • Repeated draws without replacement: If you need to assign 12 items randomly (e.g., order of players), use a random permutation. In Excel, you can use =SORTBY(SEQUENCE(12), RANDARRAY(12)) to get a random ordering of 1–12. In Google Sheets, =SORT(SEQUENCE(12), RANDARRAY(12), TRUE) works similarly.
  • Security-sensitive: Use a cryptographic generator, like crypto.getRandomValues() in a browser, or a physical method like drawing lots from a hat.

If you need a number right now, the simplest is to use an online generator or the formula in your spreadsheet. But if you’re offline, a d12 is the classic solution.

Common Problems and Misconceptions

One common misconception is that a random number generator “remembers” previous results. Unless you explicitly program it to avoid repeats, each draw is independent—getting a 7 twice in a row is just as likely as any other pair (1/144). Another misconception is that a sequence like 1,2,3,4,5,6 is “less random” than 3,8,1,11,5,9. In a truly random sequence, any specific sequence of six numbers has the same probability (1/12^6). Our brains see patterns, but randomness doesn’t care.

A practical problem: when using a d6 to simulate a d12 (rolling twice), you must map the outcomes correctly. For example, roll die A to decide high/low (e.g., 1–3 = low, 4–6 = high), then roll die B for the exact number within that half (1–6). This gives a uniform 1–12. If you instead roll two d6 and add them, you get a bell curve (2–12), not uniform—that’s a common mistake.

Another issue: online generators sometimes include “exclude” options or allow duplicates. If you need unique numbers (like for a raffle), make sure you use a “no repeats” setting or a permutation method.

Costs, Safety, and Alternatives

Most methods are free. Online generators are free, spreadsheet functions are built-in, and a d12 costs a few dollars. There are no safety concerns with generating a random number itself, but be cautious about using random numbers for security purposes (like passwords). For passwords, always use a dedicated password manager’s generator, not a simple 1–12 range.

Alternatives to a single number include:

  • Random month picker: If you’re choosing a month, you could use a calendar or a spinner wheel online.
  • Random integer in a different range: Adjust the formula to =RANDBETWEEN(1, n) for any n.
  • Random decimal: If you need a decimal between 1 and 12, use =RAND()*11+1 in Excel (gives a value from 1 to just under 12).

For a quick, unbiased pick, the methods above are all you need. The choice depends on your environment and whether you need true randomness or just a good approximation.

Frequently Asked Questions

Is the number 7 truly random? Yes, in the sense that it was chosen by a random process. The fact that it’s 7 is coincidental; any other number had the same chance. If you’re asking about the specific output I gave, it’s a single sample from a uniform distribution—no pattern is implied.

How do I generate a random number in Excel without it changing every time? By default, =RANDBETWEEN(1,12) recalculates whenever the sheet changes. To keep a fixed number, copy the cell and paste as values (right-click > Paste Special > Values). Alternatively, use a macro or a static list of pre-generated numbers.

What’s the difference between RAND and RANDBETWEEN? RAND() returns a decimal between 0 and 1, while RANDBETWEEN(bottom, top) returns an integer between the two bounds. For a 1–12 integer, use RANDBETWEEN. If you need a decimal, use =RAND()*11+1.

Can I use a random number generator for a fair draw? Yes, as long as the generator is unbiased. Online generators using atmospheric noise are considered fair for most purposes. For legal or high-stakes draws, you might want a certified random number service or a notarized physical draw.

Why do humans often pick 7 when asked for a random number? Psychological studies have shown that 7 is a “lucky” number in many cultures and is also the most common single-digit choice when people try to be random. This is why human-generated “random” numbers are not truly random—they’re biased toward certain values.

How can I generate a random number without a computer? Use a 12-sided die, a deck of cards (12 distinct cards), or even a spinner with 12 sections. For a quick mental method, you can use a watch: look at the seconds and take modulo 12 (e.g., seconds 1–12 map directly, 13–24 map to 1–12, etc.), but this is not perfectly uniform because 60 seconds are not a multiple of 12. A better physical method is to use two coins: toss a coin to decide high (7–12) or low (1–6), then use a d6 for the exact number.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.