added fast pseudo-random integer generator

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@319 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2006-08-13 14:06:50 +00:00
parent 622c9e09fd
commit 33aba9c913

View File

@@ -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