Loading ...
Sorry, an error occurred while loading the content.

Atlantis random generator

Expand Messages
  • Beholder
    Hi! Hmm, beeing bored I tested the getrandom(int) function. Eh, was a little bit shocked. For example, getrandom(4) shows such results (500 iterations): 0: 128
    Message 1 of 2 , May 3, 2002
    • 0 Attachment
      Hi!

      Hmm, beeing bored I tested the getrandom(int) function. Eh, was a little bit
      shocked. For example, getrandom(4) shows such results (500 iterations):
      0: 128
      1: 194
      2: 125
      3: 53
      That`s far from what should be. First question: maybe I missed smthn? If yes,
      what? If no, is this intended behavoir of getrandom?

      _______________________________________________
      With Regards Beholder
      mailto:beholder@...
    • JT
      ... Hash: SHA1 ... Here is the output of testing with getrandom and random on FreeBSD. Note that the initial getrandom is the same as yours. This is because
      Message 2 of 2 , May 3, 2002
      • 0 Attachment
        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        On Sat, 4 May 2002, Beholder wrote:
        > Hmm, beeing bored I tested the getrandom(int) function. Eh, was a little bit
        > shocked. For example, getrandom(4) shows such results (500 iterations):

        > 0: 128
        > 1: 194
        > 2: 125
        > 3: 53

        > That`s far from what should be. First question: maybe I missed smthn? If
        > yes, what? If no, is this intended behavoir of getrandom?

        Here is the output of testing with getrandom and random on FreeBSD. Note
        that the initial getrandom is the same as yours. This is because you
        forgot to call seedrandomrandom() before calling getrandom the first time.

        This test shows both getrandom() and the freebsd random() function.
        I ran 10 tests on each, each test using 500 calls to getrandom/random.

        getrandom: Test 0 [128, 194, 125, 53]
        random : Test 0 [146, 118, 116, 120]
        getrandom: Test 1 [134, 142, 103, 121]
        random : Test 1 [103, 134, 142, 121]
        getrandom: Test 2 [131, 136, 124, 109]
        random : Test 2 [113, 129, 120, 138]
        getrandom: Test 3 [106, 132, 133, 129]
        random : Test 3 [133, 129, 129, 109]
        getrandom: Test 4 [130, 139, 102, 129]
        random : Test 4 [121, 115, 139, 125]
        getrandom: Test 5 [123, 112, 143, 122]
        random : Test 5 [134, 103, 146, 117]
        getrandom: Test 6 [106, 128, 143, 123]
        random : Test 6 [122, 123, 129, 126]
        getrandom: Test 7 [112, 123, 140, 125]
        random : Test 7 [123, 128, 118, 131]
        getrandom: Test 8 [119, 115, 135, 131]
        random : Test 8 [119, 132, 126, 123]
        getrandom: Test 9 [133, 115, 122, 130]
        random : Test 9 [114, 138, 116, 132]

        Going and adding the seedrandomrandom() call in where it belongs, yields
        the following.

        getrandom: Test 0 [134, 139, 116, 111]
        random : Test 0 [146, 118, 116, 120]
        getrandom: Test 1 [122, 132, 129, 117]
        random : Test 1 [103, 134, 142, 121]
        getrandom: Test 2 [135, 124, 122, 119]
        random : Test 2 [113, 129, 120, 138]
        getrandom: Test 3 [120, 119, 139, 122]
        random : Test 3 [133, 129, 129, 109]
        getrandom: Test 4 [125, 129, 126, 120]
        random : Test 4 [121, 115, 139, 125]
        getrandom: Test 5 [125, 111, 125, 139]
        random : Test 5 [134, 103, 146, 117]
        getrandom: Test 6 [125, 135, 125, 115]
        random : Test 6 [122, 123, 129, 126]
        getrandom: Test 7 [139, 110, 121, 130]
        random : Test 7 [123, 128, 118, 131]
        getrandom: Test 8 [120, 123, 111, 146]
        random : Test 8 [119, 132, 126, 123]
        getrandom: Test 9 [119, 129, 121, 131]
        random : Test 9 [114, 138, 116, 132]

        As you can see, the distributions of the numbers except for that first
        case where you forgot to properly initialize the random number generator
        are pretty evenly distributed and no better or worse than the output of
        random().

        Enjoy.

        - --JT

        - --
        [-------------------------------------------------------------------------]
        [ Practice random kindness and senseless acts of beauty. ]
        [ It's hard to seize the day when you must first grapple with the morning ]
        [-------------------------------------------------------------------------]
        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1.0.6 (GNU/Linux)
        Comment: For info see http://www.gnupg.org

        iD8DBQE80wXHlZQYYI16LJQRAty7AJ4+IVPh7rofFGDzSwVNR93Qky3iKgCgjSlh
        KG+qWpu80PEQB/OXOrkdl6E=
        =8Uxb
        -----END PGP SIGNATURE-----
      Your message has been successfully submitted and would be delivered to recipients shortly.