From 697baec3c82daf6cf1dff3e1fb15465a7f55ffa5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 18 Oct 2006 01:04:34 +0000 Subject: [PATCH] don't use RandomFloat(int*) interface; do this directly, since it really does expect something like an LCG --- stepmania/src/ArrowEffects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 59da396246..5dcb92058d 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -251,12 +251,12 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float float fScrollSpeed = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; if( pPlayerState->m_PlayerOptions.GetCurrent().m_fRandomSpeed > 0 && !bAbsolute ) { - int seed = GAMESTATE->m_iStageSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100); + /* Generate a deterministically "random" speed for each arrow. */ + unsigned seed = GAMESTATE->m_iStageSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100); - /* Temporary hack: the first call to RandomFloat isn't "random"; it takes an extra - * call to get the RNG rolling. */ - RandomFloat( seed ); - float fRandom = RandomFloat( seed ); + for( int i = 0; i < 3; ++i ) + seed = ((seed * 1664525u) + 1013904223u) & 0xFFFFFFFF; + float fRandom = seed / 4294967296.0f; /* Random speed always increases speed: a random speed of 10 indicates [1,11]. * This keeps it consistent with other mods: 0 means no effect. */