Advertisement
luk_per

Untitled

May 27th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.99 KB | None | 0 0
  1.  void GeneratorTest(){
  2.                 int seed = 17389;
  3.                 int seed1 = 13963;
  4.                 int seed2 = 10457;
  5.                 string[] Uniform = new string[10000];
  6.                 string[] Exponential = new string[10000];
  7.                 string[] Geometric = new string[10000];
  8.                 string[] Normal = new string[10000];
  9.  
  10.  
  11.                 for (int i = 0; i < 10000; i++)
  12.                 {
  13.                     //Console.WriteLine( 500.0 + new Generator().UniformZO(ref seed) * (2500.0 - 500.0));
  14.                     Uniform[i] = Convert.ToInt32(new Generator().UniformAB(100, 200, ref seed)).ToString();
  15.                     Exponential[i] = Convert.ToInt32(new Generator().Exponential(1800, ref seed1)).ToString();
  16.                     Geometric[i] = Convert.ToInt32(new Generator().Geometric(0.22, ref seed2)).ToString();
  17.                     Normal[i] = new Generator().Normal(300, 0.1, ref seed).ToString();
  18.                 }
  19.  
  20.                 string pathDesktopGen = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
  21.                 string filePathGen = pathDesktopGen + "\\generators.csv";
  22.  
  23.                 if (!File.Exists(filePathGen))
  24.                 {
  25.                     File.Create(filePathGen).Close();
  26.                 }
  27.                 string delimterGen = " ";
  28.                 System.Collections.Generic.List<string[]> outputGen = new System.Collections.Generic.List<string[]>();
  29.  
  30.        
  31.                // outputGen.Add(Uniform);
  32.              //   outputGen.Add(Exponential);
  33.                outputGen.Add(Geometric);
  34.                 //outputGen.Add(Normal);
  35.  
  36.                 int length = outputGen.Count;
  37.  
  38.                 using (System.IO.TextWriter writerGen = File.CreateText(filePathGen))
  39.                 {
  40.                     for (int index = 0; index < length; index++)
  41.                     {
  42.                         writerGen.WriteLine(string.Join(delimterGen, outputGen[index]));
  43.                     }
  44.                 }
  45.  
  46.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement