Changeset 9287
- Timestamp:
- 03/05/13 18:45:44 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ALGLIB/3.7.0/ALGLIB-3.7.0/ap.cs
r9268 r9287 570 570 public class math 571 571 { 572 //public static System.Random RndObject = new System.Random(System.DateTime.Now.Millisecond); 573 public static System.Random rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000*System.DateTime.Now.Second + 60*1000*System.DateTime.Now.Minute); 572 //public static System.Random RndObject = new System.Random(System.DateTime.Now.Millisecond); 573 [ThreadStatic] //mkommend: added thread static attribute to RNG to have a separate instance per thread and allow modification of the seed 574 public static System.Random rndobject; 574 575 575 576 public const double machineepsilon = 5E-16; … … 579 580 public static bool isfinite(double d) 580 581 { 582 if (rndobject == null) rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000 * System.DateTime.Now.Second + 60 * 1000 * System.DateTime.Now.Minute); 581 583 return !System.Double.IsNaN(d) && !System.Double.IsInfinity(d); 582 584 } … … 585 587 { 586 588 double r = 0; 589 if (rndobject == null) rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000 * System.DateTime.Now.Second + 60 * 1000 * System.DateTime.Now.Minute); 587 590 lock(rndobject){ r = rndobject.NextDouble(); } 588 591 return r; … … 591 594 { 592 595 int r = 0; 596 if (rndobject == null) rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000 * System.DateTime.Now.Second + 60 * 1000 * System.DateTime.Now.Minute); 593 597 lock(rndobject){ r = rndobject.Next(N); } 594 598 return r;
Note: See TracChangeset
for help on using the changeset viewer.