# Homework Help: Difference rand and randn command matlab

1. Nov 14, 2013

### eltrinco

i am confused between when to use rand and randn . can someone explain to me please?

2. Nov 15, 2013

### Simon Bridge

Both are pseudo-random number generators.
http://www.mathworks.com/help/matlab/random-number-generation.html

type "help rand" and "help randn" for a description.

Code (Text):
rand()
Return a matrix with random elements uniformly distributed
on the interval (0, 1).  The arguments are handled the same
as the arguments for eye'.

randn()
Return a matrix with normally distributed pseudo-random
elements having zero mean and variance one.  The arguments
are handled the same as the arguments for rand'.
You should be able to see the result by filling a vector with them and plotting.