Skip to content

Instantly share code, notes, and snippets.

// http://mrl.nyu.edu/~perlin/noise/
(function(){
window.perlin = function(x, y, z){
var floorX = Math.floor(x), floorY = Math.floor(y), floorZ = Math.floor(z);
var X = floorX & 255, Y = floorY & 255, Z = floorZ & 255;
x -= floorX;
y -= floorY;
@SignpostMarv
SignpostMarv / gist:6727415
Last active December 24, 2015 01:59 — forked from volodymyr-mykhailyk/gist:2923227
do one-time test to return a typed array where supported.
var stringToByteArray = (function(){
var func = function (str) {
var b = [], i, unicode;
for(i = 0; i < str.length; i++) {
unicode = str.charCodeAt(i);
// 0x00000000 - 0x0000007f -> 0xxxxxxx
if (unicode <= 0x7f) {
b.push(unicode);
// 0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
} else if (unicode <= 0x7ff) {