From 96695ca6152ad2a6a2551518930b28ff47907757 Mon Sep 17 00:00:00 2001 From: Jan Van Bruggen Date: Sun, 20 Feb 2022 02:23:03 -0700 Subject: [PATCH] Simplify random steps --- examples/scatter.roc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/scatter.roc b/examples/scatter.roc index c5a8d92..65225ed 100644 --- a/examples/scatter.roc +++ b/examples/scatter.roc @@ -46,9 +46,10 @@ pointCount = 100000 randomSeed = 123 min = 0 max = 100000 +initial = { seed: ScatterRandom.seed32 randomSeed, value: randomSeed } randomPoints = List.repeat pointCount 0 - |> List.walk { previous: { seed: ScatterRandom.seed32 randomSeed, value: randomSeed }, values: [] } (\state, _ -> - now = ScatterRandom.step state.previous.seed (ScatterRandom.u32 min max) + |> List.walk { previous: initial, values: [] } (\state, _ -> + now = ScatterRandom.next state.previous (ScatterRandom.u32 min max) x = Num.toFloat state.previous.value y = Num.toFloat now.value values = List.append state.values (P2 x y)