diff options
author | Linus Nordberg <linus@nordberg.se> | 2000-03-20 13:48:05 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2000-03-20 13:48:05 +0100 |
commit | 5a30c4cee23a5b1e51653bfaa54b817d669b7c95 (patch) | |
tree | aae224fd98559328da608c5f1ea662591dfc2bc2 /rand.c | |
parent | 9c57bd241ba6ceafb8c3c27af45d8accd249056d (diff) | |
download | gmp-5a30c4cee23a5b1e51653bfaa54b817d669b7c95.tar.gz |
(__gmp_rand_scheme): Clean up some. Use slightly better multipliers.
Diffstat (limited to 'rand.c')
-rw-r--r-- | rand.c | 82 |
1 files changed, 45 insertions, 37 deletions
@@ -29,47 +29,55 @@ MA 02111-1307, USA. */ containing all zeros. */ static __gmp_rand_lc_scheme_struct __gmp_rand_scheme[] = { - /* FIXME: Testing. Remove. */ - {8, "7", 0, "256"}, - + /* FIXME: Remove. */ + {8, "7", 0, "256"}, /* Test. */ {31, /* fbsd rand(3) */ "1103515245", /* a (multiplier) */ 12345, /* c (adder) */ "0x80000000"}, /* m (modulo) = 2^31 */ - /* The multipliers are all between 0.01m and 0.99m, and are - congruent to 5 (mod 8). */ - - /* FIXME: Run a spectral test on each of the generators and verify - that the multiplier is good. */ - - {32, "42964341", 1, "0x100000000"}, /* pass: spect(6); merit>1 */ - {33, "85899933", 1, "0x200000000"}, /* pass: spect(6); merit>1 */ - {34, "171799469", 1, "0x400000000"}, /* pass: spect(6); merit>1 */ - {35, "343598461", 1, "0x800000000"}, /* pass: spect(6); merit>1 */ - - {36, "687196269", 1, "0x1000000000"}, /* pass: spect(6); merit>1 */ - {37, "1374564613", 1, "0x2000000000"}, /* pass: spect(6); merit>3 */ - {38, "2749193437", 1, "0x4000000000"}, /* pass: spect(6); merit>3.1 */ - {39, "5497652029", 1, "0x8000000000"}, /* pass: spect(6); merit>3 */ - {40, "10995138701", 1, "0x10000000000"}, /* pass: spect(6); merit>2.5 */ - - {56, "720575942521269", /* pass: spect(6); merit>2 */ - 1, "0x100000000000000"}, - {64, "184467440744758277", /* pass: spect(6) (no merit >1 up to 184467440750242261) */ - 1, "0x10000000000000000"}, - {100, "12676506002282294015055173877", /* low merit2; working: agnesi (12676506002282294015146266925) */ - 1, "0x10000000000000000000000000"}, - {128, "3402823669209384634633746074363516093", /* low merit2+3; working: dupont */ - 1, "0x100000000000000000000000000000000"}, - {156, "913438523331814323877303020447676887284957853", /* working: bob */ - 1, "0x1000000000000000000000000000000000000000"}, - {196, "1004336277661868922213726307713226626576376871114287459829", /* low merit*; working: dupond (1004336277661868922213726307713226626576376871114345439621) */ - 1, "0x10000000000000000000000000000000000000000000000000"}, - {200, "16069380442589902755419620923411626025222029937827928353021", /* working: haj */ - 1, "0x100000000000000000000000000000000000000000000000000"}, - {256, "1157920892373161954235709850086879078532699846656405640394575840079131296413", /* working: moufang */ - 1, "0x10000000000000000000000000000000000000000000000000000000000000000"}, + /* {31, "22298549", 1, "0x80000000"},*/ + /* merit >= 1; no merit > 3 up to 32845469 */ + + /* The following multipliers are all between 0.01m and 0.99m, and + are congruent to 5 (mod 8). They all pass the spectral test with + Vt >= 2^(30/t) and merit >= 0.1. + + Up to and including 40 bits, merit >= 3. + Up to and including 56 bits, merit >= 2. + Up to and including 64 bits, merit >= 1. */ + + {32, "43840821", 1, "0x100000000"}, + {33, "85943917", 1, "0x200000000"}, + {34, "171799469", 1, "0x400000000"}, + {35, "343825285", 1, "0x800000000"}, + {36, "687285701", 1, "0x1000000000"}, + {37, "1374564613", 1, "0x2000000000"}, + {38, "2749193437", 1, "0x4000000000"}, + {39, "5497652029", 1, "0x8000000000"}, + {40, "10995212661", 1, "0x10000000000"}, + {56, "720575942521269", 1, "0x100000000000000"}, + /* no merit >3 up to 720575942889605 */ + {64, "184467440744758277", 1, "0x10000000000000000"}, + /* no merit >2 up to 184467440750242261 */ + + {100, "12676506002282294015055173877", 1, "0x10000000000000000000000000"}, + /* low merit2; (12676506002282294015146266925) */ + {128, "3402823669209384634633746074363516093", + 1, "0x100000000000000000000000000000000"}, + /* low merit2+3; (3402823669209384634633746074396970501) */ + {156, "913438523331814323877303020447676887284958173", + 1, "0x1000000000000000000000000000000000000000"}, + /* low merit* */ + {196, "1004336277661868922213726307713226626576376871114287459829", + 1, "0x10000000000000000000000000000000000000000000000000"}, + /* low merit*; (1004336277661868922213726307713226626576376871114345439621) */ + {200, "16069380442589902755419620923411626025222029937827928353349", + 1, "0x100000000000000000000000000000000000000000000000000"}, + /* low merit*; */ + {256, "1157920892373161954235709850086879078532699846656405640394575840079131296733", + 1, "0x10000000000000000000000000000000000000000000000000000000000000000"}, + /* low merit*; */ {0, NULL, 0, NULL} /* End of array. */ }; @@ -100,7 +108,7 @@ gmp_rand_init (s, alg, size, seed) /* Pick a scheme. */ - for (sp = __gmp_rand_scheme; sp->bits; sp++) + for (sp = __gmp_rand_scheme; sp->bits != 0; sp++) if (sp->bits >= size) break; if (!sp->bits) /* Nothing big enough found. */ |