A pseudorandom number generator is like a special kind of toy that makes up numbers without really thinking, it just follows rules.
Imagine you have a box with numbered marbles inside, and every time you shake the box, one marble pops out. That’s a random number! But if you always shake the box in the same way, you might get the same sequence of numbers each time. A pseudorandom number generator is like that box, it uses rules to make up numbers that look random, even though they follow a pattern.
How It Starts
A PRNG usually needs a starting point called a seed. Think of the seed like your favorite way to shake the box. If you start with the same seed, you’ll get the same sequence of marbles (numbers) every time.
Following Rules
Once it starts, the PRNG follows a simple rule, maybe it takes the last number and does some quick math to find the next one. It's like playing a game where each move depends on the last one you made. Even though it uses rules, the numbers still look random, just like how marbles might seem to pop out in no particular order, even if you shake the box the same way every time.
Examples
- A game that uses a secret number to decide who wins
- A dice roll that repeats every time you play
Ask a question
See also
- How Does Searching For Meaning In Randomness Work?
- How Does Patterns within randomness! Explained using mocktails 🍹 Work?
- How Much Does Luck Decide Our Lives?
- What are gaussian ensembles?
- Is Anything Truly Random?