-
Notifications
You must be signed in to change notification settings - Fork 21
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
Seed UI #3006
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
@@ -38,6 +38,7 @@ export abstract class SymbolicDist extends BaseDist { | |||
// In this process we want the xyPointLength to be a bit longer than the eventual toSparkline downsampling. 3 is fairly arbitrarily. | |||
xyPointLength: bucketCount * 3, | |||
sampleCount: env.sampleCount, | |||
seed: env.seed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awkward, because dist/*
should never do anything with env.seed
. Whenever dist/*
functions need randomness, they take a separate explicit rng: PRNG
.
So the only reason you have to pass the seed here is because Env
type in dist/*
and env
in SqProject
are the same type.
So it makes me want to... I'm not really sure, separate Env
and DistEnv
types, probably?
Fixing this now is not critical, and it's a bigger refactoring, but maybe it deserves a comment somewhere.
@@ -75,6 +81,7 @@ export const defaultPlaygroundSettings: PlaygroundSettings = { | |||
environment: { | |||
sampleCount: 1000, | |||
xyPointLength: 1000, | |||
seed: "default_seed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reason why I think the playground (and also CLI) should start with a random seed: sometimes I want to use it as the source of randomness.
mx(List.upTo(1, 6)) -> sample now always produces the same output. I know I can re-roll, but that's an extra click.
This also gets in the way of building a calculator for generating random values; it's initial output would always be the same.
(by the lucky coincidence, it's always 4, as in xkcd/221)
(could be a nice way to cheat in board games or casual bets, btw, "ok, let's open squiggle playground and check...")
packages/components/src/components/ViewerWithMenuBar/RunSeedButton.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/components/ViewerWithMenuBar/RunSeedButton.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/components/ViewerWithMenuBar/RunSeedButton.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/components/ViewerWithMenuBar/RunSeedButton.tsx
Outdated
Show resolved
Hide resolved
@@ -15,6 +15,8 @@ export type SquiggleEditorProps = { | |||
defaultCode?: string; | |||
onCodeChange?(code: string): void; | |||
editorFontSize?: number; | |||
seed?: string; | |||
setSeed?(seed: string): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These props are unused. Also, it's a problem that editors don't have re-rolls, e.g. in documentation we could have an example with randomness that would be hard to experiment with without random seeds.
No description provided.