From fb0756e622b083969ce153559ce030c2c57ac3fb Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 5 May 2020 10:00:40 -0500 Subject: [PATCH] move random sampling method into separate class, general cleanup, update .gitignore with less --- procedural-placement/Assets/PointGeneration.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 procedural-placement/Assets/PointGeneration.cs diff --git a/procedural-placement/Assets/PointGeneration.cs b/procedural-placement/Assets/PointGeneration.cs new file mode 100644 index 0000000..67394d5 --- /dev/null +++ b/procedural-placement/Assets/PointGeneration.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using UnityEngine; + +public class PointGeneration { + public static List random_sampling(int numPoints, Vector2 range, Vector2 offset) { + // Create a new empty list of points, and add some randomly + List points = new List(); + for (int i = 0; i < numPoints; i++) { + points.Add( + new Vector2( + Random.Range(-range.x, range.x), + Random.Range(-range.y, range.y))); + } + + return points; + } +} \ No newline at end of file