Skip to content

Commit 94dc3d6

Browse files
authored
Merge pull request #13 from savi-lang/update/latest-savi
Update for latest Savi syntax.
2 parents ad9bea8 + 5c54f82 commit 94dc3d6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Random.savi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@
105105
product = random.u64.wide_multiply(limit)
106106
// Reject and try again if the tail happens to be in the zone of bias.
107107
// The loop will continue generating new numbers until we get a good sample.
108-
if (product.tail < limit) (
108+
if product.tail < limit (
109109
threshold = limit.negate % limit
110-
while (product.tail < threshold) (
110+
while product.tail < threshold (
111111
product = random.u64.wide_multiply(limit)
112112
)
113113
)
@@ -128,9 +128,9 @@
128128
product = random.u32.wide_multiply(limit)
129129
// Reject and try again if the tail happens to be in the zone of bias.
130130
// The loop will continue generating new numbers until we get a good sample.
131-
if (product.tail < limit) (
131+
if product.tail < limit (
132132
threshold = limit.negate % limit
133-
while (product.tail < threshold) (
133+
while product.tail < threshold (
134134
product = random.u32.wide_multiply(limit)
135135
)
136136
)
@@ -146,7 +146,7 @@
146146
:: If you need fully unbiased results, use the `unbiased_u32_less_than`
147147
:: method instead, which discards all samples from the biased zone.
148148
:fun ref usize_less_than(limit USize)
149-
if (USize.bit_width == 32) (
149+
if USize.bit_width == 32 (
150150
@u32_less_than(limit.u32).usize
151151
|
152152
@u64_less_than(limit.u64).usize
@@ -162,7 +162,7 @@
162162
:: To keep maximum performance at the cost of some possibility of bias,
163163
:: use the `uSize_less_than` method instead, which never discards results.
164164
:fun ref unbiased_usize_less_than(limit USize) USize
165-
if (USize.bit_width == 32) (
165+
if USize.bit_width == 32 (
166166
@unbiased_u32_less_than(limit.u32).usize
167167
|
168168
@unbiased_u64_less_than(limit.u64).usize
@@ -186,7 +186,7 @@
186186
:fun ref random_bytes(size USize) Bytes
187187
bytes = Bytes.new_iso(size)
188188

189-
while (size > 0) (
189+
while size > 0 (
190190
case size > (
191191
| 8 | bytes.push_native_u64(@u64), size -= 8
192192
| 4 | bytes.push_native_u32(@u32), size -= 4

0 commit comments

Comments
 (0)