We have reduced support for legacy browsers.

What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.

What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.

Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »

Fastest way to generate this kind of noise

Hey,
I want to achieve some kind of random slight color change in every single pixel every frame, and also based on how far from the center every pixel is.
What’s the fastest way to generate noise every frame? I know Math.random() is slow so I should not use that. Eventually, is the perlinNoise function able to output a bitmapdata where every pixel is randomized (both in R, G and B)?
I could then blend it using a premade alpha bitmap.
Though I don’t thing perlin noise is fast at all either.
Thanks!

The first thing to do is try [BitmapData.noise()](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#noise%28%29) and see if that’s fast enough.
If it turns out not to be, you can try these pseudorandom number generators instead: [1](http://gskinner.com/blog/archives/2008/01/source_code_see.html) [2](http://drawlogic.com/2007/04/30/as3-random-number-generator/) [3](http://seld.be/code/seededrand).

noise() would have been my first guess as well. If it’s too slow, you could generate a large BitmapData of noise (say 4000×4000 so you don’t exceed the FP10 BitmapData size limits and needlessly crash legacy players) at game start, apply whatever effects you want that do not depend on position, and then copyPixels() a random portion of it every frame on which you apply your radial effects.
Another option is to generate a Perlin noise bitmapdata at game startup and change the offsets of the various harmonics to random stuff at each frame. That would shift the various components, making it _look_ like the noise is different. It’s been used to animate cloud effects, so I know this one’s fast enough to use in a frame renderer.