rand_unit_vector {clugenr} | R Documentation |
Get a random unit vector with num_dims
components.
Description
Get a random unit vector with num_dims
components.
Usage
rand_unit_vector(num_dims)
Arguments
num_dims |
Number of components in vector (i.e. vector size). |
Value
A random unit vector with num_dims
components.
Note
This function is stochastic. For reproducibility set a PRNG seed with set.seed.
Examples
r <- rand_unit_vector(4)
norm(r, "2")
[Package clugenr version 1.0.3 Index]