Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20727

Random.setRandomSeed() does not create a unique seed

    • Fully Compatible
    • ALL
    • Hide
      for (i=0;i<3;i++) { print(new Date()); Random.setRandomSeed(); }
      

      Thu Oct 01 2015 17:03:00 GMT-0400 (EDT)
      setting random seed: 1443733380232
      Thu Oct 01 2015 17:03:00 GMT-0400 (EDT)
      setting random seed: 1443733380232
      Thu Oct 01 2015 17:03:00 GMT-0400 (EDT)
      setting random seed: 1443733380233

      Show
      for (i=0;i<3;i++) { print( new Date()); Random.setRandomSeed(); } Thu Oct 01 2015 17:03:00 GMT-0400 (EDT) setting random seed: 1443733380232 Thu Oct 01 2015 17:03:00 GMT-0400 (EDT) setting random seed: 1443733380232 Thu Oct 01 2015 17:03:00 GMT-0400 (EDT) setting random seed: 1443733380233
    • Build B (10/30/15), Build C (11/20/15)

      The shell function Random.setRandomSeed() is not reliable to set a random seed, since it relies on new Date().getTime()), which is only a millisecond based value.

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            jonathan.abrahams Jonathan Abrahams
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: