# Sample vectors uniformly from the surface of a sphere

Source:`R/embedding.R`

`sample_sphere_surface.Rd`

Sample finite-dimensional vectors to use as latent position vectors in random dot product graphs

## Value

A `dim`

(length of the `alpha`

vector for
`sample_dirichlet()`

) times `n`

matrix, whose columns are the sample
vectors.

## Details

`sample_sphere_surface()`

generates uniform samples from \(S^{dim-1}\)
(the `(dim-1)`

-sphere) with radius `radius`

, i.e. the Euclidean
norm of the samples equal `radius`

.

## See also

Other latent position vector samplers:
`sample_dirichlet()`

,
`sample_sphere_volume()`

## Examples

```
lpvs.sph <- sample_sphere_surface(dim = 10, n = 20, radius = 1)
RDP.graph.3 <- sample_dot_product(lpvs.sph)
vec.norm <- apply(lpvs.sph, 2, function(x) {
sum(x^2)
})
vec.norm
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
```