HaxeFlixel/flixel — pull request #1148 by steverichey (2014-06-03 13:36:03+00:00)
Title: Update FlxRandom, see #1146 (do not merge!)

This is a WIP update to `FlxRandom` to resolve problems pointed out in issue #1146 and add a Perlin Noise function. I'm putting in a PR now so others smarter than me can make sure I'm on the right track. :)

Currently, this still uses `Int` as the internal seed for all targets other than JS and `Int64` for JS. However, as I noted in the discussion #1146, it seems that using `Int` is giving inaccurate results. Given the hassle of using `Int64` (calling `ofInt()` and `toInt()` all the time) it probably makes more sense to use `Float` for the internal seed. My only concern with this would be float math errors resulting in a seed with a fractional component (`24.99999999997` for example), especially after many calls to `FlxRandom`.

Perlin Noise is on hold ATM while I resolve the inaccuracies above, but that will be the next step. I've also moved some values around and dropped `weightedGetObject()` in favor of an optional `WeightsArray` parameter for `getObject()`.