% Regression test function (black blox) for FreeMat v4.0
% This function is autogenerated by helpgen.
function bbtest_success = bbtest_rand
  bbtest_success = 1;
NumErrors = 0;
try
  rand(2,2,2)

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
NumErrors = 0;
try
  rand([2,2,2])

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
NumErrors = 0;
try
  x = rand(1,10000);

catch
  NumErrors = NumErrors + 1;
end
try
  mean(x)

catch
  NumErrors = NumErrors + 1;
end
try
  var(x)

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
NumErrors = 0;
try
  rand('state',0)    % restores us to startup conditions

catch
  NumErrors = NumErrors + 1;
end
try
  a = rand(1,3)      % random sequence 1

catch
  NumErrors = NumErrors + 1;
end
try
  b = rand('state'); % capture the state vector

catch
  NumErrors = NumErrors + 1;
end
try
  c = rand(1,3)      % random sequence 2  

catch
  NumErrors = NumErrors + 1;
end
try
  rand('state',b);   % restart the random generator so...

catch
  NumErrors = NumErrors + 1;
end
try
  c = rand(1,3)      % we get random sequence 2 again

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
