There is no randomness primitive today. This blocks tests, sims,
property-based testing, and most game/graphics demos.
Proposal
Expose randomness as a standard effect (consistent with IO,
Time, etc.) to keep it explicit and mockable:
[Rand.int 100]
[Rand.float]
[handle expr [Rand.int n] [resume 42]]
Add an entry point for seeding so tests can be deterministic.
Acceptance criteria
- Effect declared in
loon-lang with a default handler in the runtime.
- Documented in
ref/effects.loon.
- A test that uses a custom handler to make
Rand.int deterministic.
There is no randomness primitive today. This blocks tests, sims,
property-based testing, and most game/graphics demos.
Proposal
Expose randomness as a standard effect (consistent with
IO,Time, etc.) to keep it explicit and mockable:Add an entry point for seeding so tests can be deterministic.
Acceptance criteria
loon-langwith a default handler in the runtime.ref/effects.loon.Rand.intdeterministic.