bad random generation

Yedidya Israel yedidya at bimacs.BITNET
Sun May 12 15:43:59 AEST 1991


I am sending this posting in favor of muskat at bimacs.cs.biu.ac.il
(muskat at bimacs.bitnet), please reply directory to him, if you can
help. Thanks.

>From muskat Thu May  9 11:50:22 1991
Date: Thu, 9 May 91 11:50:11 +0200
From: muskat (Prof. J. B. Muskat)
Comments: Internet address: bimacs.cs.biu.ac.il. Bitnet address: bimacs.bitnet.
         Old internet address (bimacs.biu.ac.il) is available only temporarily.
To: yedidya
Status: R

To whom it may concern:

        Recently I used the random generator  random()  with the default
seed to generate input for sorting programs.  While scanning the results,
I noticed two pairs of very close numbers in the output.  When I then
reviewed the input, I was disturbed to find that these numbers came from
nearby positions in the input list, in positions 26 and 29, 27 and 30,
respectively.  Since I am not an expert in random number generation, I
should appreciate your reaction.

        The program, compiled with  gcc  and run on a VAX,
and the output are appended.

                                Sincerely,
                                Joseph B. Muskat


#define N 40

main()
{   int i;
    long heap[N+1];
    for  (i = 1;  i <= N;  i++)
    {   heap[i] = random();
        printf("%3d %12ld %10lx\n", i, heap[i], heap[i]);
    }
}

  1   2078917053   7be9c1bd
  2    143302914    88aa102
  3   1027100827   3d38509b
  4   1953210302   746b9fbe
  5    755253631   2d04417f
  6   2002600785   775d4351
  7   1405390230   53c48d96
  8     45248011    2b26e0b
  9   1099951567   418fedcf
 10    433832350   19dbc19e
 11   2018585307   78512adb
 12    438263339   1a1f5e2b
 13    813528929   307d7761
 14   1703199216   6584c1f0
 15    618906479   24e3c36f
 16    573714703   2232310f
 17    766270699   2dac5ceb
 18    275680090   106e8b5a
 19   1510320440   5a05a938
 20   1583583926   5e6392b6
 21   1723401032   66b90348
 22   1965443329   75264901
 23   1098183682   4174f402
 24   1636505764   618b18a4
 25    980071615   3a6ab4bf
 26   1011597961   3c4bc289 <
 27    643279273   2657a9a9 <<
 28   1315461275   4e68589b
 29   1011597962   3c4bc28a <
 30    643279275   2657a9ab <<
 31    461447352   1b8120b8
 32   1438163612   55b8a29c
 33   1946862188   740ac26c
 34    392880757   176ae275
 35   1581466526   5e43439e
 36    826479367   31431307
 37    198607412    bd68234
 38    189236509    b47851d
 39    681596504   28a05658
 40   1603997642   5f9b0fca

--
| Israel Yedidya, Math & CS Department, Bar-Ilan U, Ramat-Gan, ISRAEL. |
+----------------------------------------------------------------------+
| Internet: yedidya at bimacs.cs.biu.ac.il         Bitnet: yedidya at bimacs |
|          Uucp: ...!uunet!pucc.princeton.edu!bimacs!yedidya           |
\----------------------------------------------------------------------/
 \--- If someone proves there is no God, I'll stop being religious ---/
  --------------------------------------------------------------------



More information about the Comp.unix.questions mailing list