#define WeatherIDArraySize (100) #define ChangeWeatherEachSeconds (3600) OnLaunch() { //new timestamp = gettime(); new timestamp = 1329176916; new steps = 20; new step_amount = 1800; printf("Generating numbers from timestamp %d to timestamp %d in steps of %d",timestamp,timestamp+(steps*step_amount),step_amount); for(new i = timestamp, j = timestamp+(steps*step_amount); i <= j; i+=step_amount) { RND_SetSeed( i ); printf("My: %d RJ: %d XBC: %d",ReturnForeCastWeather(i),hash(i),RND_Get(0,WeatherIDArraySize)); } return 1; } //my stock ReturnForeCastWeather(timestamp) { new DividedSeed = floatround(timestamp/ChangeWeatherEachSeconds); return DividedSeed % WeatherIDArraySize; } //Kaganar stock hash(a) { a = (a+0x7ed55d16) + (a<<12); a = (a^0xc761c23c) ^ (a>>19); a = (a+0x165667b1) + (a<<5); a = (a+0xd3a2646c) ^ (a<<9); a = (a+0xfd7046c5) + (a<<3); a = (a^0xb55a4f09) ^ (a>>16); return a; } //xxbbcc static const INITIAL_VALUE = 0x50000; static const INCREMENT = 0xC39EC3; static const MULTIPLIER = 0x43FD43FD; new m_nRnd; stock RND_CRnd( nSeed = -1 ) { if(nSeed == (-1))m_nRnd = INITIAL_VALUE; else m_nRnd = nSeed; } stock RND_SetSeed( nSeed ) { m_nRnd = nSeed; } stock RND_GetSeed(){return m_nRnd;} stock RND_Get(nFrom,nTo) { if ( nTo < nFrom ) // nFrom should be less than nTo { new nTmp = nTo; nTo = nFrom; nFrom = nTmp; } else if ( nTo == nFrom ) { return ( nTo ); } m_nRnd = ( m_nRnd * MULTIPLIER + INCREMENT ) & 0xFFFFFF; new Float:fTmp = floatdiv(m_nRnd,16777216.0); return ( floatround ( ( fTmp * ( nTo - nFrom + 1 ) ) + nFrom ) ); }