randi
- randi(imax) returns a uniformly distributed random integer between 1 and imax
- randi(imax, n, m) returns a n x m uniformly distributed random integer between 1 and imax
- randi(imax, n) is equivalent to randi(imax, n, n)
Examples
> randi(10)# 7
> randi(10,2,3)# 8 1 5 10 4 3
> x = randi(10,50,1) [x:50x1 double] > histogram(x, struct('barWidth', 20, 'xAxisName', 'k', 'yAxisName', 'p(x=k)','norm', 'probability')) [ans:1x1 struct]