Learn creative coding writing simple programs

66. How random is random? randomSeed() & noiseSeed()

If you ever need to get the same random values time after time, you can achieve that by using randomSeed() and noiseSeed(). They affect random() and noise() respectively, and both take just one numeric parameter. By default, Processing selects a random seed for both random() and noise() when your program starts. But if you set a specific seed using randomSeed() or noiseSeed(), the random values you get will be the same each time. For instance, if you run randomSeed(123); and then print(random(100)); the random number you get is always the same number between 0 and 100.

Tags: random, noise, randomSeed, noiseSeed

Code editor

You can make changes to the code below. Then

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:
``` void setup() { size(600, 600); } ```