Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/RandomExtensions.cs @ 12747

Last change on this file since 12747 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 724 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6
7namespace Microsoft.Research.DynamicDataDisplay.Common
8{
9  internal static class RandomExtensions
10  {
11    public static Point NextPoint(this Random rnd)
12    {
13      return new Point(rnd.NextDouble(), rnd.NextDouble());
14    }
15
16    public static Point NextPoint(this Random rnd, double xMin, double xMax, double yMin, double yMax)
17    {
18      double x = rnd.NextDouble() * (xMax - xMin) + xMin;
19      double y = rnd.NextDouble() * (yMax - yMin) + yMin;
20      return new Point(x, y);
21    }
22
23    public static Vector NextVector(this Random rnd)
24    {
25      return new Vector(rnd.NextDouble(), rnd.NextDouble());
26    }
27  }
28}
Note: See TracBrowser for help on using the repository browser.