Serving the Quantitative Finance Community

  • 1
  • 6
  • 7
  • 8
  • 9
  • 10
 
User avatar
Cuchulainn
Topic Author
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Dynamic Creation of Pseudorandom Number Generators

March 18th, 2015, 7:31 pm

QuoteThe idea is that you combine the two. Eg in retrospect (early versions) QL made a mistake here (afaik, what I've seen) by gluing them together. .. Like you did here.. However, at that time there was no standard to adhere to.I would qualify this statement by adding "IMO" to it.In fairness, QL code is shipping and has a large base. You speak Dutch as your first language we moeten roeien met de riemen die we hebben.Same here.
Last edited by Cuchulainn on March 17th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Dynamic Creation of Pseudorandom Number Generators

March 19th, 2015, 10:25 am

If MAX = 10 and you have 4 threads then this work sharing #pragma omp parallel for (std::size_t i = 0; i < MAX; ++i) { std::mt19937 eng(i);then 40 engines will be created; each thread creates MAX engines That's the objective?I am still not sure if the streams are independent; that's because I have not seen any C++ 11 docs about yes or no.Compare with #pragma omp parallel for pcaspers' dcmt solution has no race condition and a good speedup. One can see how and why, and the streams are independent.
Last edited by Cuchulainn on March 18th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Dynamic Creation of Pseudorandom Number Generators

March 19th, 2015, 11:55 am

The 'issue' with dcmt in this regards is that the MT<N> classes are templated, so arrays of are not possible unless we use MPL or a cosmic base class.@pcaspers has already mentioned this.
 
User avatar
Cuchulainn
Topic Author
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Dynamic Creation of Pseudorandom Number Generators

March 19th, 2015, 12:27 pm

QuoteOriginally posted by: outrunTrue! He also has a run-time version, but that one needs low-level optimisation, ...and he's also interesting in adding the C++11 random engine interface to it.That would be great if he got the C++ 11 going.
 
User avatar
Cuchulainn
Topic Author
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Dynamic Creation of Pseudorandom Number Generators

March 19th, 2015, 12:35 pm

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: outrunTrue! He also has a run-time version, but that one needs low-level optimisation, ...and he's also interesting in adding the C++11 random engine interface to it.That would be great if he got the C++ 11 going.yes, he and I should team up on that! I also have to tweak the interface a bit, found out I'm missing one of the obligatory constructors.Indeed, go for it!
 
User avatar
Traden4Alpha
Posts: 3300
Joined: September 20th, 2002, 8:30 pm

Dynamic Creation of Pseudorandom Number Generators

March 19th, 2015, 12:54 pm

QuoteOriginally posted by: outrun.... there is a *very* small probablilty that they will overlap, the probability is approx "sequence length you generate / random engine cycle length". ......P = O(sequence length you generate / random engine cycle length) is true only for the 2-engine case. For N engines, P climbs with the number of possible engine pairs which is O(N^2). Of course, if the goal is a large fixed number of RNs, then sequence length drops O(N) as more engines are used which leaves a net probability of some overlap in some pair of engines thats O(N * total RN count / random engine cycle length).
Last edited by Traden4Alpha on March 18th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Traden4Alpha
Posts: 3300
Joined: September 20th, 2002, 8:30 pm

Dynamic Creation of Pseudorandom Number Generators

March 21st, 2015, 11:54 am

LOL! I like your upper and lower bound, but don't they need to be normalized by something? Given C > S > N >>1, (C-S)*(C-2S)*...(C-(N-1)S) * C^(N-1) will be an extremely large integer, not a probability.