Skip to content

Creating a new instance of Random every time can lead to identical output #1

@sbrl

Description

@sbrl

At https://github.com/moonpyk/ncuid/blob/master/NCuid/Cuid.cs#L104, you create a new instance of Random every time the method is called. If I call it in a loop very quickly, then that part of the cuid won't be truly random, as C♯ / .NET seeds Random with the system's clock.

Consider making Random a private static member of the class itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions