title: JavaScript simplex / perlin noise
body: <p>I'm trying to create a perlin / simplex / value noise function in JavaScript that will give results similar to the following:</p>
  
  <p><img src="https://i.stack.imgur.com/EBqMH.jpg" alt="enter image description here">
  (Note: this image has already had a treshold applied. I want it without the treshold.)</p>
  
  <p>I've been looking all over the internet for 2 days now. There are plenty of links explaining noise and a lot of code, but none in JavaScript, and whenever I try to convert it, I get weird results. Here are some of my attemps:</p>
  
  <ul>
  <li><a href="http://jsfiddle.net/GZCye/" rel="noreferrer">http://jsfiddle.net/GZCye/</a></li>
  <li><a href="http://jsfiddle.net/Lk56f/" rel="noreferrer">http://jsfiddle.net/Lk56f/</a> (<a href="http://freespace.virgin.net/hugo.elias/models/m_perlin.htm" rel="noreferrer">based on this</a>)</li>
  <li><a href="http://pastebin.com/nMA40SrL" rel="noreferrer">http://pastebin.com/nMA40SrL</a> (doesn't run in Fiddle for some reason, <a href="http://stephencarmody.wikispaces.com/Simplex+Noise" rel="noreferrer">based on this</a></li>
  </ul>
  
  <p>I think part of the problem might stem from the use of the bitwise operators in JavaScript, where it is difficult to enforce the type of a number.</p>
  
  <p>What I'm looking for is an example of working, JavaScript noise (whatever type).</p>
  
  <p>I'd also be willing to grant a bounty for any information pertaining to the parameters that could lead to a pattern similar to the image I posted (before threshold) or any optimization tips since I'll need this to run as fast as possible (in JavaScript nonetheless).</p>