Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock Float:floatrandom1(Float:max)
- {
- return floatmul(floatdiv(float(random(cellmax)), float(cellmax - 1)), max);
- }
- stock Float:floatrandom2(Float:min, Float:max)
- {
- new imin = floatround(min);
- return floatdiv(float(random((floatround(max)-imin)*100)+(imin*100)),100.0);
- }
- public OnGameModeInit()
- {
- new timee = gettime();
- for(new i = 0; i < 1000000; i++)
- {
- new Float:randomness = floatrandom1(50.0);
- printf("%f", randomness);
- }
- new first_took = gettime()-timee;
- timee = gettime();
- for(new i = 0; i < 1000000; i++)
- {
- new Float:randomness = floatrandom2(10.0, 50.0);
- printf("%f", randomness);
- }
- printf("First took: %d, Second took: %dms", first_took, gettime()-timee);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement