ForumsProgramming ForumMath Random Help

2 3414
alsage
offline
alsage
132 posts
Nomad

So I want to do a math Random thing where its like from one spot to another like... It only spawns between 300 and 400 on the y direction... here is what I have for random code

objArr[j].y = Math.round(Math.random() * 550);
  • 2 Replies
Secretmapper
offline
Secretmapper
1,747 posts
Nomad

YOu may want to use a base number, then an add random function to get the 300 and 400 of y direction

BeastMode10
offline
BeastMode10
374 posts
Nomad

For the random code:

objArr[i].y = Math.round((Math.random() * 100) + 300)

If you want the y variable to be a random number from 300 to 400.

Showing 1-2 of 2