A quick little WebGL minecraft(-esque?) 3D voxel land generation demo I made. All JavaScript. Something I hope to bring open source some day. Possibly a fun WebGL Minecraft client.

YouTube Preview Image

Going to learn a little more about one of my favorite NoSQL options and it’s new merger CouchBase at CouchConf!

July 29th 2011 in San Francisco. If anyone is going and wants to chat, drop me a line.

CouchConf

There seems to be nowhere on the internet that has code for a random number generator for JavaScript that does normal (Gaussian) distribution of values. You may remember this distribution as the ‘bell curve’ from school. This is really cool for picking random numbers that don’t distribute linearly. Using the Box-Muller transform seems to be the best way to do this in the real world, so I wrote a little function that will do it for you in JavaScript ;) Enjoy!

Math.nrand = function() {
	var x1, x2, rad;
 
	do {
		x1 = 2 * this.random() - 1;
		x2 = 2 * this.random() - 1;
		rad = x1 * x1 + x2 * x2;
	} while(rad >= 1 || rad == 0);
 
	var c = this.sqrt(-2 * Math.log(rad) / rad);
 
	return x1 * c;
};