[Plugin] [REL] MerRandom v2.0 - Mersenne Twister Randoms
#11

Quote:
Originally Posted by Tannz0rz
Quote:
Originally Posted by 0rb
Quote:
Originally Posted by cyber_punk
I noticed a hell of a speed increase to the responses from the randoms
Sorry but have you actually profiled it?

Because I've tested and was very surprised... Results, from my laptop, for 500000 calls:
Code:
random
 -> Average time per call :    68 ns
 -> Total execution time :    34 ms
 -> Calls per second   : 14705883 calls

MRandom
 -> Average time per call :  51258 ns
 -> Total execution time :  25629 ms
 -> Calls per second   :  19509 calls
(took the best 2 results)

My profiling method:
pawn Code:
#define BENCH_INIT(%1); new BT1=GetTickCount(),BT2,BI1,BI2=%1;

#define BENCH(%1(%2)); \
{\
  for(BI1=0;BI1<BI2;BI1++)\
    %1(%2);\
\
  BT2=GetTickCount();\
  BT1=BT2-BT1;\
\
  printf("\n"#%1"\n -> Average time per call : %8.f ns\n -> Total execution time : %8d ms\n -> Calls per second   : %8.f calls",\
  (float(BT1)/BI2)*1000000,BT1,(float(BI2)/BT1)*1000);\
\
  BT1=BT2;\
}

main()
{
  BENCH_INIT(500000);

  BENCH(random(101));
  BENCH(random(101));
  BENCH(MRandom(100));
  BENCH(MRandom(100));
  BENCH(random(101));
  BENCH(random(101));
  BENCH(MRandom(100));
  BENCH(MRandom(100));
}
Just being curious about how you noticed a speed increase because as you can see, random() is about 750x faster
In this case, speed honestly shouldn't be a reason as to why you wouldn't want to use this. The randoms with Mersenne are, pardon my lack of words, more "random", while the pawn-generated version is a tad bit sad.
Upside down.
Reply


Messages In This Thread
[REL] MerRandom v2.1 - Mersenne Twister Randoms - by cyber_punk - 18.11.2009, 15:48
Re: [REL] MerRandom - Mersenne Twister Randoms - by Google63 - 18.11.2009, 16:42
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 18.11.2009, 16:48
Re: [REL] MerRandom - Mersenne Twister Randoms - by Tannz0rz - 18.11.2009, 18:45
Re: [REL] MerRandom - Mersenne Twister Randoms - by Correlli - 18.11.2009, 18:47
Re: [REL] MerRandom - Mersenne Twister Randoms - by potato - 18.11.2009, 21:39
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 18.11.2009, 22:40
Re: [REL] MerRandom - Mersenne Twister Randoms - by potato - 19.11.2009, 12:17
Re: [REL] MerRandom - Mersenne Twister Randoms - by yom - 19.11.2009, 12:58
Re: [REL] MerRandom - Mersenne Twister Randoms - by Tannz0rz - 19.11.2009, 19:08
Re: [REL] MerRandom - Mersenne Twister Randoms - by MenaceX^ - 19.11.2009, 19:54
Re: [REL] MerRandom - Mersenne Twister Randoms - by Tannz0rz - 19.11.2009, 20:21
Re: [REL] MerRandom - Mersenne Twister Randoms - by yom - 19.11.2009, 20:53
Re: [REL] MerRandom - Mersenne Twister Randoms - by MenaceX^ - 20.11.2009, 12:37
Re: [REL] MerRandom - Mersenne Twister Randoms - by yom - 20.11.2009, 12:39
Re: [REL] MerRandom - Mersenne Twister Randoms - by Woet - 20.11.2009, 12:46
Re: [REL] MerRandom - Mersenne Twister Randoms - by MenaceX^ - 20.11.2009, 12:55
Re: [REL] MerRandom - Mersenne Twister Randoms - by DiDok - 20.11.2009, 13:52
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 20.11.2009, 18:12
Re: [REL] MerRandom - Mersenne Twister Randoms - by potato - 20.11.2009, 20:16
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 21.11.2009, 02:45
Re: [REL] MerRandom - Mersenne Twister Randoms - by potato - 21.11.2009, 12:31
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 21.11.2009, 12:55
Re: [REL] MerRandom - Mersenne Twister Randoms - by DiDok - 21.11.2009, 14:40
Re: [REL] MerRandom - Mersenne Twister Randoms - by DiDok - 26.11.2009, 14:19
Re: [REL] MerRandom - Mersenne Twister Randoms - by Destrojer - 26.11.2009, 15:31
Re: [REL] MerRandom - Mersenne Twister Randoms - by Google63 - 01.12.2009, 16:50
Re: [REL] MerRandom - Mersenne Twister Randoms - by MJ! - 11.12.2009, 17:55
Re: [REL] MerRandom - Mersenne Twister Randoms - by Correlli - 11.12.2009, 18:03
Re: [REL] MerRandom - Mersenne Twister Randoms - by Tannz0rz - 11.12.2009, 18:04
Re: [REL] MerRandom - Mersenne Twister Randoms - by MJ! - 11.12.2009, 18:38
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 30.08.2010, 12:10
Re: [REL] MerRandom - Mersenne Twister Randoms - by wups - 05.09.2010, 12:09
Re: [REL] MerRandom - Mersenne Twister Randoms - by cyber_punk - 05.09.2010, 14:35
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by nemesis- - 07.09.2010, 03:18
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by cyber_punk - 07.09.2010, 13:49
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by nemesis- - 07.09.2010, 14:28
Respuesta: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by xenowort - 07.09.2010, 17:43
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by cyber_punk - 26.09.2010, 23:01
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by cyber_punk - 27.10.2010, 20:52
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by MisterTickle - 22.09.2011, 08:53
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by [L3th4l] - 22.09.2011, 09:22
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by aRoach - 22.09.2011, 12:36
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by cyber_punk - 22.09.2011, 17:01
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by Edvin - 22.09.2011, 18:43
Re: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by Kyle - 27.06.2012, 10:59
Respuesta: [REL] MerRandom v2.0 - Mersenne Twister Randoms - by Siralos - 15.08.2012, 15:23

Forum Jump:


Users browsing this thread: 3 Guest(s)