What are pseudo-random number generators?

A pseudo-random number generator is like a special machine that creates numbers that seem random but are actually made by following a rule.

Imagine you have a toy box full of numbered balls, each ball has a different number on it, from 1 to 10. You shake the box and pick one ball without looking. That’s random, because you don’t know which one will come out next.

Now imagine the box is magical in a way that you can choose how it shakes, like turning a dial or pushing a button. Even though it looks random, it's not totally unpredictable. This is like a pseudo-random number generator: it uses simple rules to make numbers that look random, but if you know the rule, you could guess what comes next.

How It Works

A pseudo-random number generator starts with a seed, think of it as the first number in your toy box. Then it follows a special recipe (like counting or multiplying) to create more numbers. These new numbers look like they came from a real random process, but they’re just following a pattern.

It’s like having a friend who always picks balls based on how many times you’ve shaken the box before, clever, but not truly magical!

Take the quiz →

Examples

  1. A coin flip is like a simple random number generator, but pseudo-random ones use math to create patterns that look random.
  2. Using a dice roll to pick a song from your playlist is a fun example of randomness in action.
  3. A game uses numbers between 1 and 100 to choose which enemy appears next, that’s a basic random number generator at work.

Ask a question

See also

Discussion

Recent activity