Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Random 3D Walk
Posted:
Oct 21, 2012 10:34 AM


Michael Have a for loop over the number of steps you want to take, say a thousand or so but start with around 10 or 20 while you're still developing and debugging it. Then inside the loop get random numbers with rand() and add it to the x and y coordinate values. Then use an if statement to see if adding that random number would put the particle on the other side of the barrier. If it would, change the coordinate to what it would be as if it had bounced off that barrier.



