From f9d50da5e1d8416e785f4924f66ec183d9a8f2cf Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 28 Mar 2006 19:15:44 +0000 Subject: [PATCH] cleanup for easier debugging --- stepmania/src/RageUtil.cpp | 7 +++++-- stepmania/src/RageUtil.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 9db4118640..2bc709f814 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -46,9 +46,12 @@ RandomGen::RandomGen( unsigned long seed_ ) seed = time(NULL); } -int RandomGen::operator() ( int maximum ) +int RandomGen::operator() ( int n ) { - return int(RandomFloat( seed ) * maximum); + float f = RandomFloat(seed) * (n); + int ans = int(f); + CLAMP( ans, 0, n-1 ); + return ans; } diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 58766175fe..52f9e43384 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -183,7 +183,7 @@ class RandomGen public: RandomGen( unsigned long seed = 0 ); - int operator() ( int maximum = INT_MAX-1 ); + int operator() ( int n = INT_MAX-1 ); // return number [0,n) };