Start New Discussion within our Software Development Community

can you help me with the code for that using the logic:
1) randomly select the start point
2) predetermine the distance you need that car to travel using nextGaussian()
3) identify all the end points that are that distance away
4) randomly select one

as you can see, i don't know how to do steps 3 and 4

for (int i = 0; i < Math.random() * 10; i++) {
            int drivingDistance = 0
            int mean = 50;
            int stddev = 30;
            Random r = new Random();

            //randomly pick start points
            int startX = (int)(Math.random() * gridWidth);
            int startY = (int)(Math.random() * gridHeight); 

            //pick driving distance
            drivingDistance = (int)(r.nextGaussian() * stddev + mean);

            //find all possible destinations given start point

            //randomly pick one

"identify all the end points that are that distance away"
Does that imply that there is a finite list of known end points?
If not, just get a random deltaX in the range (0 - drivingDistance), set deltaY to (drivingDistance - deltaX), so the sum of the x and y distance is the desired total, then the end point is x +or- deltaX, y +or- deltaY

This question has already been answered. Start a new discussion instead.