runif2: Generate randomly oriented vectors in 2D

Description Usage Arguments Value Author(s) See Also Examples

View source: R/runif2.R

Description

Generate randomly oriented vectors in 2D, following an isotropic distribution (optionally truncated to a region).

Usage

1
runif2(n = 1, r = c(0, 1), azimuth = c(0, 2 * pi))

Arguments

n

number of random vectors to be generated

r

2-vector specifying the range of radii

azimuth

2-vector specifying the range of azimuth angles

Value

Returns an n-by-2 array of n vectors.

Author(s)

Danail Obreschkow

See Also

runif3

Examples

1
2
3
4
5
## 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)

physx documentation built on Feb. 3, 2022, 5:08 p.m.

Related to runif2 in physx...