function [] = LCGPlanes(NumPts);
% Points generated by the RANDU LCG in 3-space.
% argument = Num of Pts to generate: 10000 is reasonable
% Hit the space bar to move to each successive view
% The command "view(45, 45)" makes it look quite random.
% view(-37.5, 30) or view(3) reveals the hyperplanes quite nicely.

a = 2^16 + 3;
b = 2^31;

ThePts = zeros(NumPts, 1);
ThePts(1) = 1;
for n = 1:NumPts-1,
  ThePts(n+1) = rem(a * ThePts(n), b);
end

ThePts = ThePts / b;

x = ThePts(1:NumPts - 2);
y = ThePts(2:NumPts - 1);
z = ThePts(3:NumPts);

plot3(x, y, z, 'g.');

for az = -5:-10: -35,
  view(az, -az);
  pause;
end
