Ejemplo n.º 1
0
        public void ToFile(SerializableMersenneTwister smt, string filename)
        {
            var info = new MersenneTwisterSerializationInfo
            {
                MT  = smt.MT,
                MTI = smt.MTI
            };

            FileIO.WriteToJson(info, filename);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// methods to save current state of random number generator
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static SerializableMersenneTwister FromFile(string filename)
        {
            var info = FileIO.ReadFromJson <MersenneTwisterSerializationInfo>(filename);

            return(SerializableMersenneTwister.Create(info));
        }