# Thread: MATLAB: Random numbers

1. ## MATLAB: Random numbers

I am trying to generate a sequence of 100 random numbers from N (0, 1) using the matlab command randn. I am completely new to matlab so I had a look at the documentation, however, I am still unclear as to how exactly to use the randn command. I understand that one of the parameters is the stream from which the random numbers are obtained and the other parameter is the matrix size.

2. Originally Posted by agentsmith270288
I am trying to generate a sequence of 100 random numbers from N (0, 1) using the matlab command randn. I am completely new to matlab so I had a look at the documentation, however, I am still unclear as to how exactly to use the randn command. I understand that one of the parameters is the stream from which the random numbers are obtained and the other parameter is the matrix size.
Basic operation should work, try

N=randn([1,100])

(iirc this will use a state set from the system clock to start the stream)

.

3. ## MATLAB: random numbers

Thanks, I was doing something similar to this but wasn't sure if it was right. However, what if I wanted to compute random numbers from N(5,25) or any other distribution, how would that be done?

4. Originally Posted by agentsmith270288
Thanks, I was doing something similar to this but wasn't sure if it was right. However, what if I wanted to compute random numbers from N(5,25) or any other distribution, how would that be done?
rand([1.100])*5+5

or rather:

rand([1.100])*SD+mean

.