spawning objects randomly and evenly in a certain radius

I’m completely new to programing and a total noob but I’ve been trying to get
a number of objects to spawn in a random area on the x and z axis’s and so I’ve been using Random.range but the objects seem to clump up in the center and thin out at the edges.

is there any way to spawn them semi evenly dispersed but still very random?

Could you try:

var position1=2.5;

var position1=3.5;

var position1=4.5;

//spawn at

position1+Random.Range(0.0,0,5);
position2+Random.Range(0.0,0,5);
position13+Random.Range(0.0,0,5);

See what I loosely gesturing at? :stuck_out_tongue:

AC

thanks :smile:

but is there a easier way to spawn a large number of objects like 30 to 50?
without writing a position for every object

generate the position inside a loop cycle, like a while or a for, FOR example:

for ( int i = 0; i < 30; i++ )
{
   // generate random position
   // instantiate the object in that position
}

.org