Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8805


Ignore:
Timestamp:
10/15/12 09:35:16 (12 years ago)
Author:
mkommend
Message:

#1968: Added initialization code for the RNG in the ALGLIB sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ALGLIB/3.6.0/ALGLIB-3.6.0/ap.cs

    r8803 r8805  
    493493    //public static System.Random RndObject = new System.Random(System.DateTime.Now.Millisecond);
    494494    [ThreadStatic] //mkommend: added thread static attribute to RNG to have a separate instance per thread and allow modification of the seed
    495     public static System.Random rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000 * System.DateTime.Now.Second + 60 * 1000 * System.DateTime.Now.Minute);
     495    public static System.Random rndobject;
    496496
    497497    public const double machineepsilon = 5E-16;
     
    505505    public static double randomreal() {
    506506      double r = 0;
     507      if (rndobject == null) rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000 * System.DateTime.Now.Second + 60 * 1000 * System.DateTime.Now.Minute);
    507508      lock (rndobject) { r = rndobject.NextDouble(); }
    508509      return r;
     
    510511    public static int randominteger(int N) {
    511512      int r = 0;
     513      if (rndobject == null) rndobject = new System.Random(System.DateTime.Now.Millisecond + 1000 * System.DateTime.Now.Second + 60 * 1000 * System.DateTime.Now.Minute);
    512514      lock (rndobject) { r = rndobject.Next(N); }
    513515      return r;
Note: See TracChangeset for help on using the changeset viewer.