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 are welcome! :) But please try to stay close to the topic of this episode. Use the Processing forums for help with your Processing projects (or hire me for help ;-)