Skip to content

Commit 96695ca

Browse files
committed
Simplify random steps
1 parent b255e0c commit 96695ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/scatter.roc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ pointCount = 100000
4646
randomSeed = 123
4747
min = 0
4848
max = 100000
49+
initial = { seed: ScatterRandom.seed32 randomSeed, value: randomSeed }
4950
randomPoints = List.repeat pointCount 0
50-
|> List.walk { previous: { seed: ScatterRandom.seed32 randomSeed, value: randomSeed }, values: [] } (\state, _ ->
51-
now = ScatterRandom.step state.previous.seed (ScatterRandom.u32 min max)
51+
|> List.walk { previous: initial, values: [] } (\state, _ ->
52+
now = ScatterRandom.next state.previous (ScatterRandom.u32 min max)
5253
x = Num.toFloat state.previous.value
5354
y = Num.toFloat now.value
5455
values = List.append state.values (P2 x y)

0 commit comments

Comments
 (0)