diff --git a/include/lmms_math.h b/include/lmms_math.h index f54a3c196..71de4a1fc 100644 --- a/include/lmms_math.h +++ b/include/lmms_math.h @@ -27,6 +27,8 @@ #define _LMMS_MATH_H + + // Equivalent to _x - floorf( _x ) static inline float fraction( const float _x ) { @@ -35,4 +37,17 @@ static inline float fraction( const float _x ) } + + +#define FAST_RAND_MAX 32767 +static inline int fast_rand( void ) +{ + static unsigned long next = 1; + next = next * 1103515245 + 12345; + return( (unsigned)( next / 65536 ) % 32768 ); +} + + + + #endif