powered by
Generate randomly oriented vectors in 2D, following an isotropic distribution (optionally truncated to a region).
runif2(n = 1, r = c(0, 1), azimuth = c(0, 2 * pi))
number of random vectors to be generated
2-vector specifying the range of radii
2-vector specifying the range of azimuth angles
Returns an n-by-2 array of n vectors.
runif3
# NOT RUN { ## generate 500 unit vectors with radii between 0.5 and 1 x = runif2(500,r=c(0.5,1)) oldpar = par(pty='s') plot(x,pch=20) par(oldpar) # }
Run the code above in your browser using DataLab