public override void Reset() { PseudoRandom rsg = new PseudoRandom(); _pg = rsg.make_sequence_generator(_process.size() * (_grid.size() - 1), _seed) as MultiPathGenerator <InverseCumulativeRsg <RandomSequenceGenerator <MersenneTwisterUniformRng>, InverseCumulativeNormal> >; }
public void build_irHistoryData(DateTime startDate, DateTime endDate, bool withClear) { CalendarManager cm = new CalendarManager(DateTime.Now, CalendarManager.CountryType.SOUTH_KOREA); PseudoRandom random = new PseudoRandom(); //RandomSequenceGenerator<MersenneTwisterUniformRng> randGen = random.make_sequence_generator(1000, 1) as RandomSequenceGenerator<MersenneTwisterUniformRng>; int genNum = Convert.ToInt32((endDate - startDate).TotalDays) * this.sampleIR_.Count; IRNG randGen = random.make_sequence_generator(genNum, Convert.ToUInt64(this.random_.Next())) as IRNG; int i = 0; Sample<List<double>> sample = randGen.nextSequence(); clsHDAT_MARKETDATA_TB clstb = new clsHDAT_MARKETDATA_TB(); foreach (VasicekParameter para in this.sampleIR_) { SquareRootProcess vasicek = new SquareRootProcess(para.LongTermRate_, para.Speed_, para.Vol_ , para.Initial_); clstb.INDEX_CD = para.Name_; if (withClear) { clstb.DeleteIndex(); clstb.REF_DT = startDate.ToString("yyyyMMdd"); clstb.LAST = para.Initial_; clstb.LOW = para.Initial_; clstb.HIGH = para.Initial_; clstb.Insert(); } DateTime roopDate = startDate; DateTime nextDate = cm.adjust(roopDate, "1D"); while (nextDate < endDate) { clstb.REF_DT = roopDate.ToString("yyyyMMdd"); nextDate = cm.adjust(roopDate, "1D"); this.irData(para.Name_, vasicek, sample.value[i], roopDate, nextDate); roopDate = nextDate; i += 1; } } }