num_dims
R/core.R
rand_unit_vector.Rd
Get a random unit vector with num_dims components.
rand_unit_vector(num_dims)
Number of components in vector (i.e. vector size).
A random unit vector with num_dims components.
This function is stochastic. For reproducibility set a PRNG seed with set.seed.
r <- rand_unit_vector(4) norm(r, "2") #> [1] 1