How to Generate Random Numbers on a Calculator

How-to basics · Updated November 23, 2026

Generating a random number on a calculator is a handy trick for games, picking lottery-like numbers, sampling, or just making quick decisions. Most scientific and graphing calculators have a built-in random number generator (often labeled RAND or RANDI), and even basic calculators can be coaxed into producing a pseudo-random result using a simple formula. This guide covers the exact steps for common calculator types, plus how to adapt the method when your calculator lacks a dedicated random button.

What You’ll Need

  • A scientific, graphing, or basic calculator (most models work; steps vary by type).
  • If using a phone or computer calculator app, check for a scientific mode (usually by rotating the device or clicking a menu).
  • A clear idea of the range you want (e.g., 1 to 10, 0 to 1, or any two numbers).

Step-by-Step

Follow the steps for the type of calculator you have. If you’re not sure which type, look for a button labeled RAND, RAN#, or RANDI.

For Scientific Calculators (e.g., Casio fx-991, TI-30X)

  1. Turn on the calculator and press the MODE button if needed to ensure you’re in a normal calculation mode (usually “COMP” for Casio).
  2. Press the SHIFT (or 2nd) key, then the key that has RAN# printed above it. On many Casio models, it’s the . (decimal point) key. On TI models, it’s often MATH → PRB → rand.
  3. Press = (or ENTER) to generate a random number between 0 and 1 (including 0, excluding 1). For example, you might see 0.4378291.
  4. To get a random integer between 1 and N (like 1 to 6), multiply the result by N, then add 1, then take the integer part. For example, to get a die roll (1–6):
    • Press RAN# → you get 0.4378291.
    • Multiply by 6: press × 6 = → 2.6269746.
    • Add 1: press + 1 = → 3.6269746.
    • Take the integer part: press SHIFT Rnd (or use the INT function if available) → 3. That’s your random integer.
  5. For a random integer between A and B (where A is lower, B is higher), use the formula: INT(RAN# * (B - A + 1)) + A. For example, for 10 to 20, compute INT(RAN# * 11) + 10.

For Graphing Calculators (e.g., TI-84, TI-Nspire, Casio fx-CG50)

  1. Turn on the calculator and go to the home screen (press 2nd then QUIT on TI-84).
  2. Access the random function:
    • TI-84: Press MATH, scroll to PRB (probability), then select 1:rand and press ENTER.
    • TI-Nspire: Press menu (or b), then 5: Probability, then 4: Random, then 1: Random Number.
    • Casio fx-CG50: Press OPTN, then PROB, then RAND.
  3. Press ENTER to get a random decimal between 0 and 1.
  4. To get an integer in a range, use the randInt( function (TI) or RANDI (Casio). For example, on TI-84:
    • Press MATH → PRB → 5:randInt(.
    • Type the lower bound, comma, upper bound, then close the parenthesis: randInt(1,6).
    • Press ENTER to get a random integer between 1 and 6.
  5. For a random decimal in a custom range, use rand multiplied by the range width plus the lower bound. For example, to get a number between 5 and 15: rand * 10 + 5.

For Basic (Non-Scientific) Calculators

  1. Use the time-based trick: Many basic calculators can produce a pseudo-random number using the current time or a simple arithmetic sequence.
  2. Enter a large seed number (like 123456789) and press ×, then enter another large number (like 987654321), then press =. The calculator will show a long decimal or large integer. The last few digits can be used as a random-ish number.
  3. Alternatively, use the RAN# key if your basic calculator has one (some do, often labeled RAN or RND). Press it and then = to get a random decimal.
  4. To get an integer, multiply the decimal by your maximum number, add 1, and take the integer part (truncate the decimals). For example, if you get 0.456 and want 1–10: 0.456 × 10 = 4.56, add 1 = 5.56, truncate to 5.

Common Mistakes

  • Forgetting to press SHIFT or 2nd before the RAN# key. On many Casio models, the function is printed in yellow above the key; you must press SHIFT first.
  • Using the wrong formula for integer range. A common error is multiplying by the upper bound only (e.g., RAN# * 6 gives 0–5, not 1–6). Always multiply by (B – A + 1) and add A.
  • Not truncating the decimal. If you want an integer, you must remove the fractional part. Simply adding 1 to a decimal like 4.56 gives 5.56, which is not an integer.
  • Assuming the random number is truly random. Calculator random numbers are pseudo-random; they follow a pattern that repeats after many uses, but for most casual purposes it’s fine.

Tips

  • For repeated rolls or draws, press = again to generate a new random number each time. On TI-84, pressing ENTER on the randInt( command repeats it.
  • To get a random number between 0 and 1 with more precision, use the RAN# function as is; it typically gives 10–13 decimal places.
  • If your calculator has a RANDI function, it directly gives an integer in a range; check the manual for the exact syntax (often RANDI(1,6) on Casio).
  • For a quick random choice (like heads/tails), generate a random decimal and see if it’s less than 0.5 (heads) or greater/equal (tails).
  • Use the STO key to store a random number if you need to use it later in a calculation.

Troubleshooting

  • I press SHIFT + . and nothing happens. Your calculator may not have a RAN# function. Check the manual or look for a RAND or RAN label on another key. If none exists, use the manual multiplication trick described for basic calculators.
  • The number seems to repeat or is always the same. Some calculators use a fixed seed. To get a different sequence, reset the calculator or perform a few dummy operations (like sin or cos) before generating again.
  • I get a negative number or a number outside my range. Double-check your formula. For a range A to B, the correct expression is INT(RAN# * (B - A + 1)) + A. If you used RAN# * B, you’ll get 0 to B, which misses the lower bound.
  • My calculator shows an error when I try randInt(. Make sure you’re using the correct syntax: randInt(lower, upper) with a comma, not a colon. Also ensure the lower bound is less than the upper bound.
  • On a phone calculator, I can’t find the random button. Many phone calculator apps don’t have a random function. Use a scientific calculator app (like the one in Google or Apple’s calculator in landscape mode) or use the multiplication trick with a large seed.

Frequently Asked Questions

Q: Can I generate a random number on a basic calculator without a RAN# key?
A: Yes. Use the multiplication trick: enter a large number, multiply by another large number, and take the last few digits as your random number. For better randomness, use the current time by entering the seconds from a clock.

Q: How do I generate a random number between 1 and 100 on a Casio fx-991?
A: Press SHIFT + . to get RAN#, then multiply by 100, add 1, and take the integer part. Or use the formula INT(RAN# * 100) + 1.

Q: What is the difference between RAND and RANDI on a calculator?
A: RAND (or RAN#) returns a decimal between 0 and 1. RANDI (or randInt) returns a random integer within a specified range, like RANDI(1,6).

Q: Are calculator random numbers truly random?
A: No, they are pseudo-random. They are generated by a deterministic algorithm, so if you know the seed, you can predict the sequence. For casual use, they are random enough.

Q: Can I generate a random number on a graphing calculator like the TI-84 Plus CE?
A: Yes. Use MATH → PRB → rand for a decimal, or randInt( for an integer. For example, randInt(1,10) gives a number from 1 to 10.

Q: How do I get a random number with two decimal places?
A: Generate a random decimal between 0 and 1, then multiply by the range and round to two decimals using the ROUND function if available, or simply look at the first two decimals of the result.

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.