2 // System.Random Test Cases
4 // Author: Bob Smith <bob@thestuff.net>
10 namespace MonoTests.System {
12 public class RandomTest : TestCase
14 public static ITest Suite {
16 return new TestSuite(typeof(RandomTest));
20 public RandomTest() : base ("MonoTests.System.RandomTest testcase") {}
\r
21 public RandomTest(string name): base(name){}
22 public void TestDouble()
24 Random r = new Random();
27 for (i=0; i<20; i++) c+=r.NextDouble();
29 Assert (c.ToString() + " is out of range.", c < .7 && c > .3);
31 public void TestSeed()
33 Random r = new Random(42);
34 Random r2 = new Random(42);
40 c2 += r2.NextDouble();
44 public void TestNext()
46 Random r = new Random();
52 Assert (c < Int32.MaxValue && c >= 0);
55 public void TestNextMax()
57 Random r = new Random();
63 Assert (c < 10 && c >= 0);
66 public void TestNextMinMax()
68 Random r = new Random();
74 Assert (c < 10 && c >= 1);