Reverse Engineering Noise

by Quasimondo
Trying to find the algorithm that generates noise.

This sketch shows how "random" values repeat depending on their offset in the bitmap.
♥10 | Line 35 | Modified 2010-10-04 06:25:26 | MIT License
play

ActionScript3 source code

/**
 * Copyright Quasimondo ( http://wonderfl.net/user/Quasimondo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/oMXM
 */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    public class AnalyzeNoise extends Sprite {
        public function AnalyzeNoise() {
            test();
        }
        
        private function test():void
        {
            
            var b:BitmapData = new BitmapData( 64 * 16, 64 * 16,  false,0 );
            var n:BitmapData = new BitmapData( 256, 1, false, 0 );
            var gridSize:int = 40;   
            var p:int;
            var offset:int = 0;
            for ( var yy:int = 0; yy < 16; yy++ )
            {
                for ( var xx:int = 0; xx < 16; xx++ )
                {
                    var seed:int = 1;
                    for ( var y:int = 0; y < gridSize; y++ )
                    {
                        for ( var x:int = 0; x < gridSize; x++ )
                        {
                            n.noise( seed++,0,255,4,false);    
                            b.setPixel( xx * gridSize + x, yy * gridSize + y, ( p = (n.getPixel( offset, 0 ) & 0xff ) ) | ( p << 16 ) | ( p << 8));
                        }
                    }
                    offset++;
                }
            }
            
            addChild( new Bitmap( b ) );
        }

    }
}

Forked