3 ms·
Five million people see a classic case of calling random()without reseeding
- known 17y agoIn PHP 4.2.0 and later, there is no need to seed the random generator with mt_srand(). This is done automatically. http://www.w3schools.com/php/func_math_mt_rand.asp http://www.w3schools.com/php/func_math_mt_rand.asp
- streety 17y agoAlthough factually correct I don't see the relevance given that this game is Flash based and written in actionscript. Am I missing something? Also, why not link directly to the php site? http://php.net/mt_srand http://php.net/mt_srand
- hugothefrog 17y agoFunny, I was just watching a colleague play this at work the other day. He'd written an app to play the game for him - takes a screen shot, scans the bitmap, figures out the pieces, then determines an optimum set of moves.
- brunov 17y agoJust like Sweeperbot! http://sweeperbot.org/ http://sweeperbot.org/
- snorkel 17y agoReminds me of this classic cautionary tale of poor PRNG seeding, How We Learned to Cheat at Online Poker, http://www.cigital.com/papers/download/developer_gambling.php http://www.cigital.com/papers/download/developer_gambling.ph...
- chipsy 17y agoThis is partly the fault of Flash itself. It doesn't provide control over seeding the API's PRNG. A diligent coder can of course implement their own PRNG method, but that is not an excuse for providing a half-broken feature.
- tesseract 17y agoThe regular random number generator in Flash is automatically seeded and you can't specify a seed. This article, though, talks about using BitmapData.noise() which takes a seed as a parameter, and normally when I see people discussing the use of that API for general purpose random number generation it is precisely because it allows control over seeding.
- antirez 17y agorc4 is a prefect algorithm to build a fast and very high quality PRNG for instance.
- Keyframe 17y agowell I have tried to see if this is true and it seems like it isn't anymore.
- pbhjpbhj 17y agoI had the same board as in the article, but it seems to be fixed now.