Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 2
    This here probably answers it: hackernoon.com/… Commented Oct 26, 2018 at 5:35
  • One issue with your code, is that Math.random() is seeded on the current time, so even if / when it eventually finds a duplicate, your results arn't repeatable. Commented Oct 26, 2018 at 5:36
  • I mean... it is intended to be random, not a repeating sequence of seemingly random numbers. I wouldn't expect it to start repeating... Unless I'm misunderstanding something... Commented Oct 26, 2018 at 5:36
  • 1
    Then you have an X Y problem. use UUID or a clock value that always increments, that resets when Date().valueOf() returns a different value. UUID's have a scheme involving a 'machine id' a local time source that can give you unique values for a very very long time. Commented Oct 26, 2018 at 5:44
  • 1
    @RyanTheLeach - I understand now. I didn't closely review your code and thought you were looking for sequential repetitions, not simply any one repeated value. Impressive it made it overnight w/o finding a duplicate, although by the end of the evening I wonder how long a single check would take to iterate over every value you'd recorded in v-- it may have slowed significantly... Commented Oct 26, 2018 at 5:45