Explain what a random seed controls

Keep the numerator and denominator in the stated order. · 193 words

A random seed is the starting number given to a pseudorandom number generator, the program that produces a repeatable stream of seemingly random values. For example, suppose a travel app randomly picks one item from a list of 20 destinations. With seed 42 and the same list and selection code in the same software environment, it should choose the same sequence on every run. A different seed, such as 7, usually produces a different sequence. The seed controls the generator's random choices. It does not control the destination list or guarantee that two unrelated random systems use the same sequence.

In model training, a seed can control the order in which examples enter each mini-batch, a small group used to update the model. With seed 5, the same dataset and training code should usually shuffle in the same order. Repeating that run can make debugging easier because the examples arrive in the same sequence. However, a fixed seed does not freeze every part of a system: changed data, libraries, hardware, or nondeterministic operations can still alter the result. The seed makes one specified source of randomness repeatable, not the entire experiment automatically identical.

Check your recall

With the data and code unchanged, what happens when you change a sampling script's seed from 1 to 99?

Check your answer

The generator will generally produce a different sequence of random draws. The script will still be repeatable: rerunning it with seed 1 repeats the first sequence, while rerunning it with seed 99 repeats the second sequence.

Sources and credits

Original KeyTouch lesson. Background reading · UC Berkeley · Introduction to Artificial Intelligence.