Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.72 KB | None | 0 0
  1. stock Float:floatrandom1(Float:max)
  2. {
  3.     return floatmul(floatdiv(float(random(cellmax)), float(cellmax - 1)), max);
  4. }
  5.  
  6. stock Float:floatrandom2(Float:min, Float:max)
  7. {
  8.     new imin = floatround(min);
  9.     return floatdiv(float(random((floatround(max)-imin)*100)+(imin*100)),100.0);
  10. }
  11.  
  12. public OnGameModeInit()
  13. {
  14.     new timee = gettime();
  15.     for(new i = 0; i < 1000000; i++)
  16.     {
  17.         new Float:randomness = floatrandom1(50.0);
  18.         printf("%f", randomness);
  19.     }
  20.     new first_took = gettime()-timee;
  21.    
  22.     timee = gettime();
  23.     for(new i = 0; i < 1000000; i++)
  24.     {
  25.         new Float:randomness = floatrandom2(10.0, 50.0);
  26.         printf("%f", randomness);
  27.     }
  28.     printf("First took: %d, Second took: %dms", first_took, gettime()-timee);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement