Page **4** of **8**

### User feedback Mr. sitmo's prng

Posted: **December 15th, 2013, 4:08 pm**

by **Cuchulainn**

Quote double min_ = System.Convert.ToDouble( (*m_nativeClass).min() ); double max_ = System.Convert.ToDouble( (*m_nativeClass).max() );This means your png class needs min() and max()? ??

### User feedback Mr. sitmo's prng

Posted: **December 15th, 2013, 6:17 pm**

by **Cuchulainn**

1. I am getting very small rns e-209 etc. when I call C+ from C#. I added Min() and Max() to prng and cal them from C# i.e.(BTW what's the range of values [L,U] of rng()) C++ // new djd //double min() conflict with your result_type!!! double Min() { return std::numeric_limits<double>::min(); } double Max() const { return std::numeric_limits<double>::max(); }C# I // [0,1)double NextDouble(){ double min_ = (*m_nativeClass).Min() ; double max_ = (*m_nativeClass).Max() ; double rng_ = (*m_nativeClass)(); return (rng_ - min_) / (max_ - min_ + 1);}C#, IIpublic class PolarMarsaglia<T> : Rng<T>{ private SitmoWrapper.ManagedWrapper rand; public PolarMarsaglia() { rand = new SitmoWrapper.ManagedWrapper(); } // Seed is from system clock public override T GenerateRn() { dynamic u, v, S; do { u = 2.0 * rand.NextDouble() - 1.0; v = 2.0 * rand.NextDouble() - 1.0; Console.Write(", {0}", rand.NextDouble()); S = u * u + v * v; } while (S >= 1.0); dynamic fac = Math.Sqrt(-2.0 * Math.Log(S) / S); return (T)(u * fac); }}

### User feedback Mr. sitmo's prng

Posted: **December 15th, 2013, 8:21 pm**

by **Cuchulainn**

Gotcha! Your C# pseudocode confused me min() --> minAnyways; 1st MC test Pexact = 5.84585NT = 500, NSim = 10^6SitmoBoxMuller = 5.847601.NET BoxMuller = NaNCongrats!Keep tuned!

### User feedback Mr. sitmo's prng

Posted: **December 16th, 2013, 1:16 pm**

by **Cuchulainn**

Edited: error

### User feedback Mr. sitmo's prng

Posted: **December 16th, 2013, 1:47 pm**

by **Cuchulainn**

QuoteI must say I think the first result is a bit strange? How come different fdm methods don't give different results? I think1. the methods are close in accuracy anyways2. large NT, NSI can take NT = 100 and then see ....

### User feedback Mr. sitmo's prng

Posted: **December 16th, 2013, 3:51 pm**

by **Cuchulainn**

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnQuoteI must say I think the first result is a bit strange? How come different fdm methods don't give different results? I think1. the methods are close in accuracy anyways2. large NT, NSI can take NT = 100 and then see ....Ah, ok. And the "methods" in 1. are SDE discretization schemes like Euler, Milstein?Yes, it's the FDM part.

### User feedback Mr. sitmo's prng

Posted: **December 16th, 2013, 5:47 pm**

by **Cuchulainn**

Let's take Box Muller. For all NT, NS I get the same anwers for all FDM schemes for Sitmo, but .NET answers are different. So, it does not seem to matter if I use Euler or PC etc.Any ideas why?(ditto for Polar, but the values are less good than Box Muller).