All pastes #365992 Raw Edit

Anonymous

public c v1 · immutable
#365992 ·published 2007-02-21 12:23 UTC
rendered paste body
unsigned int m_currentState;void Seed( unsigned int seed ){	m_currentState = seed;}void NextState( ){	m_currentState *= 1103515245;	m_currentState += 12345;}unsigned int GetUint( ){	NextState( );	return m_currentState >> 1;}int GetInt( ){	NextState( );	return ( int ) m_currentState;}double GetDoubleClCl( ){	NextState( );	return m_currentState * ( 1.0f / ( double ) 0xFFFFFFFF );}double GetDoubleClOp( ){	NextState( );	return m_currentState * ( 1.0f / ( ( double ) 0xFFFFFFFF + 1.0f ) );}double GetDoubleOpCl( ){	NextState( );	return ( ( double ) m_currentState + 0.5 ) *	       ( 1.0f / ( double ) 0xFFFFFFFF );}double GetDoubleOpOp( ){	NextState( );	return ( ( double ) m_currentState + 0.5 ) *	       ( 1.0f / ( ( double ) 0xFFFFFFFF + 1.0f ) );}