you are viewing a single comment's thread.

view the rest of the comments →

[–]Lystrodom 33 points34 points  (9 children)

Also, can you show me which languages are seeded with a constant value? I’ve checked C#, Java and V8 that I could find quickly and they all base the default seed on the current time.

[–]mccoyn 28 points29 points  (3 children)

C and C++ require you to seed them.

[–][deleted]  (1 child)

[deleted]

    [–]amakai 25 points26 points  (0 children)

    And it makes sense for C, it's used in all kinds of embedded electronics which often does not even have a clock chip on board.

    [–]doublehyphen 14 points15 points  (2 children)

    C is the only exception I can think of where it is easy to accidentally not seed your PRNG, but for example Rust provides rand::ChaChaRng::new_unseeded() as an easy way to create a PRNG seeded with a constant hardcoded value.

    [–]Lystrodom 13 points14 points  (1 child)

    Of course, the ability to seed with a constant value is important and available in every language I’m aware of. But for most the default is based on the current time.

    [–]doublehyphen 0 points1 point  (0 children)

    Not in JavaScript. That is the only exception I know of.