Select random object from array

I’m using a script to draw point-cloud from an array of point. The script draws from the first point to the last point in the array (it draw a point every second). Is there a way to draw ALL THE POINT IN THE ARRAY ONCE (important!) in random order? Thanks.

Without seeing your code, I can’t give you many specifics but yes, you can choose random points to draw. Please remember to do a search on the site before asking.

You’ll use Random.Range() to produce a random seed and use that as the index for whichever point you want to draw. Then you keep track of what points you’ve already drawn. This part can be done a number of ways, but here are two from the top of my head:

  1. use a 2D array with a set of Bools (or just two arrays)
  2. create a Struct for your point/drawn state and make an array/list of those instead

Thanks for answer. This is the best way I found.

randomizing-arrays