Question: Problem with large array

Hi, I need to generate 100,000 numbers randomly (bounded by 0 and  t) and plot the distribution of the distance of two subsequent numbers. I tried it with a large array:


genRequestDist := proc (N, t)
local requests, i, r, pts, d; 
r := rand(t);
requests := Array(1 .. N);
for i to N do
 requests[i] := r()
end do;
pts := Array(0 .. t, 1 .. 2);
for i from 0 to t do
 pts[i, 1] := i;
 pts[i, 2] := 0
end do;
for i to N-1 do
 d := abs(requests[i+1]-requests[i]);
 pts[d, 1] := d;
 pts[d, 2] := pts[d, 2]+1
end do;
end proc


but when I want to plot it using plots-pointplot


with(plots); pointplot(genRequestDist(100000, 3600000), color = red)


I get: Error, (in plots/pointplot) object too large.

How can I solve this task using less memory?

Thanks in advance.

Please Wait...