# Maximum number in randomSeed() p5js

**URL:** <https://discourse.processing.org/t/maximum-number-in-randomseed-p5js/37352>\
**Category:** Beginners\
**Created:** [June 6, 2022, 10:21am UTC](https://discourse.processing.org/t/maximum-number-in-randomseed-p5js/37352 "2022-06-06T10:21:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 6, 2022, 12:29pm UTC](https://discourse.processing.org/t/maximum-number-in-randomseed-p5js/37352/3 "2022-06-06T12:29:20Z")

</div>

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

> <https://github.com/processing/p5.js/blob/v1.4.1/src/math/random.js#L31-L35>

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:

> **[Unsigned right shift (\>\>\>) - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift)**
>
> The unsigned right shift operator (\>\>\>)
> (zero-fill right shift) shifts the first operand the specified number of bits to the
> right.

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

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

```

> **[Nullish coalescing operator (??) - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator)**
>
> The nullish coalescing operator (??) is a logical
> operator that returns its right-hand side operand when its left-hand side operand is
> null or undefined, and otherwise returns its left-hand side
> operand.

---

_[View the full topic](https://discourse.processing.org/t/maximum-number-in-randomseed-p5js/37352)._
