Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove uses of old random generator #808

Merged
merged 1 commit into from
May 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions lib/stbcrand.gi
Original file line number Diff line number Diff line change
Expand Up @@ -975,15 +975,15 @@ InstallGlobalFunction( SCRRandomString, function ( n )
local i, j, # loop variables
k, # number of 28 long substrings
rnd, # the random number which would be created by Random
string; # the random string constructed
string, # the random string constructed
range; # Upper value of range used for getting ints

range := 2^28-1;

string:=[];
k:=QuoInt(n-1,28);
for i in [0..k-1] do
# follow steps in Random to create a random number < 2^28
R_N := R_N mod 55 + 1;
R_X[R_N] := (R_X[R_N] + R_X[(R_N+30) mod 55+1]) mod 2^28;
rnd:=R_X[R_N];
rnd := Random(0,range);
# use each bit of rnd
for j in [1 .. 28] do
string[28*i+j] := rnd mod 2;
Expand All @@ -992,9 +992,7 @@ InstallGlobalFunction( SCRRandomString, function ( n )
od;

# construct last <= 28 bits of string
R_N := R_N mod 55 + 1;
R_X[R_N] := (R_X[R_N] + R_X[(R_N+30) mod 55+1]) mod 2^28;
rnd:=R_X[R_N];
rnd := Random(0, range);
for j in [28*k+1 .. n] do
string[j] := rnd mod 2;
rnd := QuoInt(rnd,2);
Expand Down