|
On Jan 12, 8:04 am, "Alex " <ala...@yahoo.com> wrote:
> Dear all I have a matrix which is filled only with zeros.
>
> I would like to put ones into specific X random-points (X is a variable also) ones.
>
> The random X numbers should be coming from gaussian function.
>
> Could you please help me if there is something like that in R?
>
> B.R
> Alex
Hi Alex,
Have you looked at using the Acceptance - Rejection method to select a
random number that is distributed according to a Gaussian? i.e.
generate a randon number x (x could have uniform distribution) and
calculate y=f(x) where f is a gaussian. f(x) has a maximum value in
the stated interval over which x varies and f is defined. Generate
another random number, say m. Compare y vs m. If m < y(x) then accept
x else reject x. Hope this helps
|