Serving the Quantitative Finance Community

  • 1
  • 4
  • 5
  • 6
  • 7
  • 8
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 17th, 2013, 7:54 pm

QuoteThe TestU01 framework needs to draw *a lot* (100's of billion) of random numbers to test it quality, and so it want a pointer to your engine functor that it repeatedly call. Would be interesting to do, we can then add the result to the wikipedia entry. I managed to get it working in C++, maybe we can get it to work in managed C++? E.g. it needs to haveYes, no problem , it is possible to call C# from native C++ via Managed C++ (in my Excel C# DLC ... legacy code )
Last edited by Cuchulainn on December 16th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 17th, 2013, 7:56 pm

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: outrunah! I see!luckily *I* found the answer at google to your complicated question about bits and bytes I see; Next Q I want a double; is this correct?Paging mr. Sitmo, is this code look good? Only difference _now_ is I call Crypto... instead of your prng!
Last edited by Cuchulainn on December 16th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 17th, 2013, 8:47 pm

My first crypto rng for MC!NT = 500, NS = 100000P = 5.85344( P exact = 5.84584)Not bad for my 001 test.// will need >=2 dedicated threads for crypto RNG
Last edited by Cuchulainn on December 16th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 18th, 2013, 6:28 am

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnFind? I knew it for years I just didn't tell anyone!Here is my example. Q: is the byte stuff OK?QuoteWe could run it though the TestU01 framework and test its random quality?You mean the output?? It is C# code.The TestU01 framework needs to draw *a lot* (100's of billion) of random numbers to test it quality, and so it want a pointer to your engine functor that it repeatedly call. Would be interesting to do, we can then add the result to the wikipedia entry. I managed to get it working in C++, maybe we can get it to work in managed C++? E.g. it needs to haveextern "C"{#include "unif01.h"#include "bbattery.h"}I did test #2 on crypto rng; roughly on a reasonable machine using single threading it takes 30 minutes to compute 300 million rns. So, I reckon we need a multicore (have you acccess to say 16 cores?) solution for 100 billion.And a 16:1 producer-consumer solution is not a luxury here. Do you have C# compiler? (Express is free); on linux is called Mono.
Last edited by Cuchulainn on December 17th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 18th, 2013, 9:45 am

Here is runnable code for your TestU01 , it's quite fast, extrapolate ==> about 10 hours on slow vostro 1710.
Last edited by Cuchulainn on December 17th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 18th, 2013, 9:53 am

And I suspect that crypto rng is thread-safe do then processing time = 10 hours / Number_of_processors. Bingo.
Last edited by Cuchulainn on December 17th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 18th, 2013, 11:59 am

QuoteOriginally posted by: outrunNice, so you time it at 10bln random draws/hr? That's good enough for running test (but 70x slower than native C++ if you look for production MC engines).I would start it and hope that you find something interesting to publish! Maybe it fails some tests? That would be a cool research result that would get attention. Also proving that it passes all test is also a very good result. You could also repeat it for the simple random .NET generator and maybe find something there as well?Just tested 10 billion .. 1 h 46 mIn all fairness crypto rng is not meant for MC rng as it is 8 times slower than Random.What is good (?) is to use crypto for 1. GUID seed for MC rng2. Parallel seeds for nonlinear optimisation searches
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 18th, 2013, 1:27 pm

 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

User feedback Mr. sitmo's prng

December 18th, 2013, 3:19 pm

QuoteOriginally posted by: outrunIf I look at the timing then native C++ looks *much* faster than managed C++ (my rng does 10bln in 53 secs). It that really the case? If so, would the coding easy outweight the performance loss if you build a production MC engine?Bytes have to be converted to ints. So, can expect
Last edited by Cuchulainn on December 17th, 2013, 11:00 pm, edited 1 time in total.