Maximum number in randomSeed() p5js

The seed is stored by this “private” method below:

Its comment states that >>> 0 truncates the result to an unsigned 32-bit (4-byte) integer range, which is from 0 to 2**32 - 1 or 4_294_967_295 max.

You can read about the unsigned right shift operator on this link below:

Here’s a shorter way to write this[stateProperty] = (val == null ? Math.random() * m : val) >>> 0; using the nullish coalescing operator ??:

this[stateProperty] = (val ?? Math.random() * m) >>> 0;
2 Likes