public static ColorPoint MakeColorPoint() { ColorPoint colorPoint = new ColorPoint(); colorPoint.X = RandomContainer.rnd.NextDouble(); colorPoint.Y = RandomContainer.rnd.NextDouble(); colorPoint.Color = colors[RandomContainer.rnd.Next(0, colors.Length)]; return(colorPoint); }
public static void FillFile(int n) { using (FileStream writer = new FileStream("colors.txt", FileMode.OpenOrCreate)) { for (int i = 0; i < n; ++i) { var color = ColorPoint.MakeColorPoint(); writer.Write(color.ToString().ToList().ConvertAll(el => (byte)el).ToArray(), 0, color.ToString().Length); } } }