<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with randomgaussian() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=randomgaussian%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:50:39 +0000</pubDate>
         <description>Tagged with randomgaussian() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedrandomgaussian%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Pixel arrays?</title>
      <link>https://forum.processing.org/two/discussion/26442/pixel-arrays</link>
      <pubDate>Tue, 20 Feb 2018 03:01:12 +0000</pubDate>
      <dc:creator>Scott06</dc:creator>
      <guid isPermaLink="false">26442@/two/discussions</guid>
      <description><![CDATA[<p>Hello community, I am in need of your assistance; I've been working on a project for school, here's the code;</p>

<pre><code>float x;
float y;
float[][] points;
float amplitude = 150.0;
int num_waves = 15;
int[][] grid;
float increment = 0.02;


void setup()
{
  size(640,640);
}

void draw()
{
  background(0);
  float yoff=0.0;
  loadPixels();
  for(int y=0; y&lt;height; y++)
  {
    float xoff = 0.0;
    for (int x=0; x&lt;width; x++)
    {
      int index = (x+y*width);
      float r = noise(xoff,yoff)*100;
      pixels[index]= color(r,0,r,140);
      xoff+=.01;
    }
    yoff+=.01;
  }
  updatePixels();
  noLoop();
  println(randomGaussian()*pixels.length);

    float b=0;
  while (b &lt; width)
  {
    point(b, height*noise(b));
    b=b+1;
  }

translate(0,height/2);

for(int j=0; j&lt;num_waves; j++)
{
  strokeWeight(1);
  stroke(0,120,120);
  translate(-2,4);
  sineWave();
}
}

float[][] Points()
{
  points = new float[width*3][2];
  x = 0.0;
  for(int j=0; j&lt;points.length; j++)
  {
    y = amplitude*pow(sin(.015*x),5)*cos(.015*x);
    for(int i=0; i&lt;2; i++)
    {
      switch(i)
      {
        case 0:
        points[j][i]=x;
        break;
        case 1:
        points[j][i]=y;
        break;
      }
    }
    x+=PI/4;
  }
  return(points);
}


void sineWave()
{
  float[][] points = Points();
  beginShape();
  vertex(0,0);
  noFill();
  for(int n=0; n&lt;points.length; n++)
  {
    vertex(points[n][0],points[n][1]);
  }

  endShape();
}
</code></pre>

<p>Sorry that it's not the cleanest of code, I need to go back and clean it up later. But anyway, inside of the draw function, I've used the noise function to create a simple purple and black texture that fits the whole screen. What I would like to do is have the texture only take up a specified shape within the screen, such as in this image:</p>

<p><a href="https://cnet4.cbsistatic.com/img/p2JgkXzoNDuAakOloAly3fIdYl4=/fit-in/970x0/2013/05/09/8d21444e-cc2e-11e2-9a4a-0291187b029a/sine_1.jpg" target="_blank" rel="nofollow">https://cnet4.cbsistatic.com/img/p2JgkXzoNDuAakOloAly3fIdYl4=/fit-in/970x0/2013/05/09/8d21444e-cc2e-11e2-9a4a-0291187b029a/sine_1.jpg</a></p>

<p><img src="https://cnet4.cbsistatic.com/img/p2JgkXzoNDuAakOloAly3fIdYl4=/fit-in/970x0/2013/05/09/8d21444e-cc2e-11e2-9a4a-0291187b029a/sine_1.jpg" alt="" /></p>

<p>(For example in this image the noise is not really applied in any of the four corners of the image) I think I might be able to accomplish this by first drawing the shape that I want with bezier vertices, and then choose a fill color such as white, and then go through each of the pixels and testing to see if the color of the pixel is white, and then if so then apply the noise function to those pixels. I'm not sure if that would work though, and even if it does, it seems like it would be extremely tedious. Also an added bonus would be to be able to make the outer edges of the noise have a lower color saturation but that's not my primary concern.</p>

<p>Thanks for the help!</p>
]]></description>
   </item>
   <item>
      <title>Normal / U-Distributions with sin(), random(), randomGaussian() and map()</title>
      <link>https://forum.processing.org/two/discussion/18395/normal-u-distributions-with-sin-random-randomgaussian-and-map</link>
      <pubDate>Mon, 03 Oct 2016 23:55:23 +0000</pubDate>
      <dc:creator>grumo</dc:creator>
      <guid isPermaLink="false">18395@/two/discussions</guid>
      <description><![CDATA[<p>Excuse the newbieness but:</p>

<p>I need to distribute the numbers from a[30]={ABC...} in b[300] slots. 
let's say m=30, n=300. Usually we just do:</p>

<p>delta = m/n
for (int c=0; c&lt;=n; c++) {
  int ix= round(c*delta);
  b[c]=a[ix] 
}</p>

<p>so b={AAAAAAAAAABBBBBBBBBBCCCCCCCCCC...}</p>

<p>The thing is that the values are distributed evenly. I mean, if the actual distribution is {10,10,10,10,10,10,10,10,10} I need it now {15,12,11,10,7,10,11,12,15} or something like that ("slower" increment/decrement at the ends)</p>

<p>I'm making sense?</p>

<p>Thanks for any help!</p>
]]></description>
   </item>
   <item>
      <title>generating similar colors</title>
      <link>https://forum.processing.org/two/discussion/14317/generating-similar-colors</link>
      <pubDate>Thu, 07 Jan 2016 13:44:42 +0000</pubDate>
      <dc:creator>plux</dc:creator>
      <guid isPermaLink="false">14317@/two/discussions</guid>
      <description><![CDATA[<p>Hi, what I want to do is having a color (let's say red) and automatically generate other colors which are different shades of red.. I have no idea where to start..do you know examples or particular algorithms that I should look at?</p>

<p>Basically I have this code..the position of the circle changes (x axis) randomly but is still floating around the center..I would like to apply this concept to colors..</p>

<pre><code>    float xloc = (float)randomGaussian();

    int mean = width/2;
    int ds = 60;

    float x = ds * xloc + mean;


    fill(0,10);
    noStroke();
    ellipse(x, height/2,15,15);
</code></pre>

<p>thanks</p>
]]></description>
   </item>
   </channel>
</rss>