Skip to content

Make it clear that randgen/set-seed should be used to get a random seed #324

Description

@bluMyst

In the documentation for spork/randgen, I think there should be a section at the top that explains that the results of running randgen functions are deterministic by default (they'll be the same every time you run your program) and the way to avoid this is by running something like:

(randgen/set-seed (os/time))

Or some other sane default way to set the random seed.

That way newcomers from languages like Python or JavaScript - where the random seed is set to something unique by default - won't be left wondering why the random number generation in Janet "doesn't work".

It might also be helpful to have some similar notes for the random functions inside of math, but the community examples might be enough in that case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions