# Multiple seed values for noise

**URL:** <https://discourse.processing.org/t/multiple-seed-values-for-noise/20695>\
**Category:** Coding Questions\
**Created:** [May 10, 2020, 12:52am UTC](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695 "2020-05-10T00:52:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shinyogre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/shinyogre/32/9133_2.png) [@shinyogre](https://discourse.processing.org/u/shinyogre)\
**Post date:** [May 10, 2020, 12:52am UTC](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695/1 "2020-05-10T00:52:46Z")

</div>

I have multiple layers of 1D perlin noise rendering with vertices via beginShape() and endShape(). I noticed however that because each layer uses the same noise seed, their shape is quite similar and the effect is a less interesting and more obviously procedural.

I’d like each mountain to have it’s own unique distribution of values. I have tried rendering on multiple canvases, but that doesn’t work because you can’t blend each canvas into one image (which is a terrible shame!)

How can I give each shape it’s own noiseSeed()??? Or what is an alternative to achieve the same effect?

My code: [https://editor.p5js.org/shinyogre/sketches/iaI\_n5-DS](https://editor.p5js.org/shinyogre/sketches/iaI_n5-DS)

---

<div class="post-metadata">

**Author:** ![Sven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sven/32/8293_2.png) [@Sven](https://discourse.processing.org/u/Sven)\
**Post date:** [May 11, 2020, 3:34pm UTC](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695/2 "2020-05-11T15:34:32Z")

</div>

For me, when reasoning about noise, it sometimes helps to visualize it. Here’s a simple example that visualizes noise in two dimensions:

```javascript
const NOISE_SCALE = 0.04;

function setup() {
  createCanvas(400, 400);
  
  noLoop();
  
  for (let y = 0; y < height; y++) {
    for (let x = 0; x < width; x++) {
      stroke(noise(x * NOISE_SCALE, y * NOISE_SCALE) * 255);
      point(x, y);
    }
  }
}

```

 ![Perlin noise visualized. Looking like a black and white photo of the moon surface.](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/64fe9fc0fcc06b6f009e0c7160fe1b1cafb906c3.png)

When there’s visual feedback, it’s easier (and more fun) to play around with different configurations and observe what happens. Contemplating this, can you see a way to let each mountain have its own unique distribution of values? Maybe using more than one dimension?

---

<div class="post-metadata">

**Author:** ![shinyogre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/shinyogre/32/9133_2.png) [@shinyogre](https://discourse.processing.org/u/shinyogre)\
**Post date:** [May 12, 2020, 1:41am UTC](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695/3 "2020-05-12T01:41:34Z")

</div>

Okay, well I’m not sure what you had in mind, but this led me to figure out something. If I want to adjust my x dimension to eliminate the self-similarity between layers, while also preserving the “mountains” look, I found that adjusting the step component of the for loop did the trick.

So instead of noiseX++ at the end of the loop I can do something like noiseX+=5. Such that every 5th increment a vertex is created, instead of every increment.

Did you have something else in mind?

---

<div class="post-metadata">

**Author:** ![Sven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sven/32/8293_2.png) [@Sven](https://discourse.processing.org/u/Sven)\
**Post date:** [May 12, 2020, 8:02am UTC](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695/4 "2020-05-12T08:02:03Z")

</div>

Thats great, good job! As it often is, there are multiple solutions to the same problem. What I had in mind was to introduce a second dimension and assign each mountain a different part of the noise space.

```javascript
let noiseValue1 = noise(noiseX, MOUNTAIN_1);
let noiseValue2 = noise(noiseX, MOUNTAIN_2);

```

 ![Perlin noise visualized with two samplings, named MOUNTAIN_1 and MOUNTAIN_2, highlighted.](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/22601ad5509607e391f43eb3baf346447aea636c.png)

This solution and the one you ended up with are mostly doing the same thing: moving around in the noise space taking greater leaps. And thus ending up with more varied noise and exciting mountains.
