mercredi 16 octobre 2019

Generation random vector within a distance from template

I have found similar question here:but it does not refer to R. I would like to generate randomly a numeric vector which lies a defined distance from a defined numeric vector.

A=c(12,34,-2) Distance=z

Find b=c(rnorm(1),rnorm(1),rnorm(1)) with dist(A, b) < z

Any tip for me? Best




Aucun commentaire:

Enregistrer un commentaire