Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): seeded random generators #7570

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

psychedelicious
Copy link
Collaborator

Summary

Float and integer generators' random distribution supports a seed.

  • Add JS Mersenne Twister implementation dependency to use as seeded PRNG. This is not a cryptographically secure algorithm.
  • Add nullish seed field to float and integer random generators.
  • Add UI to control the seed.
  • When seed is not set, behaviour is unchanged - the values are randomized when you Invoke. When seed is set, the random distribution is deterministic depending on the seed. In this case, we can display the values to the user.

Related Issues / Discussions

https://discord.com/channels/1020123559063990373/1049495067846524939/1329770360136007732

QA Instructions

  • With seed disabled, the generator should output different values each time you click Invoke. You should not see a preview of the generated values.
  • With seed enabled, the generator should output the same values. You should see a preview of the generated values.

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog

- Add JS Mersenne Twister implementation dependency to use as seeded PRNG. This is not a cryptographically secure algorithm.
- Add nullish seed field to float and integer random generators.
- Add UI to control the seed.
- When seed is not set, behaviour is unchanged - the values are randomized when you Invoke. When seed is set, the random distribution is deterministic depending on the seed. In this case, we can display the values to the user.
@github-actions github-actions bot added frontend-deps PRs that change frontend dependencies frontend PRs that change frontend files labels Jan 17, 2025
@psychedelicious
Copy link
Collaborator Author

Demo:

Screen.Recording.2025-01-18.at.8.11.49.am.mov

@psychedelicious psychedelicious merged commit 8a41e09 into main Jan 17, 2025
15 checks passed
@psychedelicious psychedelicious deleted the psyche/feat/ui/seeded-generators branch January 17, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files frontend-deps PRs that change frontend dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants