Histogramming random numbers using rand.js and mplot.js
randn - normally distributed
figure(1); for (i = 0; i < N; i++) data[i] = randn(3); bins = linspace(-10, 10, 40); result = hist(data, bins); plot(bins, result.counts, 'b|'); xlabel('value'); ylabel('count');
randi - random integers
figure(2); for (i = 0; i < N; i++) data[i] = randi(0, 5); bins = linspace(-1, 5); result = hist(data, bins); plot(bins, result.counts, 'g|'); xlabel('value'); ylabel('count');
randf - random floats
figure(3); for (i = 0; i < N; i++) data[i] = randf(0, 5); bins = linspace(-1, 6); result = hist(data, bins); plot(bins, result.counts, 'm|'); xlabel('value'); ylabel('count');