# Can I have multiple independent random number generators with different seeds?

**URL:** <https://discourse.processing.org/t/can-i-have-multiple-independent-random-number-generators-with-different-seeds/10125>\
**Category:** Coding Questions\
**Created:** [April 9, 2019, 11:54am UTC](https://discourse.processing.org/t/can-i-have-multiple-independent-random-number-generators-with-different-seeds/10125 "2019-04-09T11:54:03Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [April 10, 2019, 12:45am UTC](https://discourse.processing.org/t/can-i-have-multiple-independent-random-number-generators-with-different-seeds/10125/4 "2019-04-10T00:45:54Z")

</div>

> [@neel](#):
>
> If I am running p5 inside of another js environment…

The only sensible solution is creating a class for random + seed. 🌱

If you prefer not to, the only other feasible solution is using iframes: 🖼

> [@Switch Between Multiple p5.js Sketches in Single Webpage](https://discourse.processing.org/t/switch-between-multiple-p5-js-sketches-in-single-webpage/9981/4):
>
> Assuming you have a variable iframe which points to the HTMLIFrameElement of the running sketch you wanna pause, you can call: iframe.contentWindow.noLoop(); Alternatively, the window property of each HTMLIFrameElement is stored in the frames[] pseudo-array: Let’s say you wanna pause the sketch running at the 3rd created HTMLIFrameElement, you simply call: frames[2].noLoop();

Let’s say you need 10 unique seeds. Then you’re gonna need 10 iframes w/ a p5js in it. 😬

---

_[View the full topic](https://discourse.processing.org/t/can-i-have-multiple-independent-random-number-generators-with-different-seeds/10125)._
