Skip to content

Add seedable random number generator #108

Open
@silentmatt

Description

@silentmatt

Right now, the random() function is just the built-in Math.random() from the environment. It might be useful to use a deterministic, seedable generator.

Some thought needs to go into how to the implementation since currently, expressions are essentially stateless. Potential options are:

  • Store the current rng state as a property of the expression and maybe provide a seedrandom() function to update it.

  • Pass in and update the seed using a special property in the variables object. Maybe with an invalid variable name so it doesn't conflict with normal variables.

Either way, it's probably useful to be able to share rng state between expressions, so it should be stored in its own object, and should allow for being set explicitly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions