Skip to content

Commit 30779ec

Browse files
adjust usage of random to changes in Fuzion base API
1 parent fb6bd6c commit 30779ec

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

benchmarks/priority_queue_benchmark.fz

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ priority_queue_benchmark =>
4545
for t := time.duration.zero, t + dur
4646
i in 1..size
4747
do
48-
rand := random.next_i32
48+
rand := random.env.next_i32
4949
dur := time.stopwatch (()->q.enqueue rand)
5050
hist_enq.add dur
5151
else
@@ -95,14 +95,14 @@ priority_queue_benchmark =>
9595
q := container.Binary_Heap_Queue m i32 .empty_min_first (queue_size + 30).as_i64
9696

9797
# fill queue
98-
for i in 1..queue_size do q.enqueue random.next_i32
98+
for i in 1..queue_size do q.enqueue random.env.next_i32
9999

100100
hist_enq := time.histogram.new "Enqueue in queue of size $queue_size" nil 10 10
101101
hist_deq := time.histogram.new "Dequeue in queue of size $queue_size" nil 10 10
102102

103103
for i in 1..sample_size
104104
do
105-
rand := random.next_i32
105+
rand := random.env.next_i32
106106
dur_enq :=time.stopwatch (()->q.enqueue rand)
107107
hist_enq.add dur_enq
108108
dur_deq :=time.stopwatch (()->_ := q.dequeue)
@@ -168,7 +168,7 @@ priority_queue_benchmark =>
168168
say "\nRandom:\n"
169169
simple_random 904644503766293287 ()->
170170
for len in test_lengths do
171-
test (array i32 .new len _->random.next_i32) "random"
171+
test (array i32 .new len _->random.env.next_i32) "random"
172172
say ""
173173

174174
say "\nReverse ordered:\n"
@@ -215,7 +215,7 @@ priority_queue_benchmark =>
215215
say "Random:\n"
216216
simple_random 904644503766293287 ()->
217217
for len in test_lengths do
218-
test (array i32 .new len _->random.next_i32) "random"
218+
test (array i32 .new len _->random.env.next_i32) "random"
219219

220220

221221

tests/priority_queue/priority_queue_test.fz

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ priority_queue_test =>
158158
_ := q6
159159
simple_random 42 ()->
160160
for i in 0..9
161-
r := random.next_i32 199 - 99
161+
r := random.env.next_i32 199 - 99
162162
do
163163
say "enqueue $r"
164164
q6.enqueue r
@@ -180,7 +180,7 @@ priority_queue_test =>
180180
m : mutate is
181181
m ! ()->
182182

183-
elements := array random_test_size _->random.next_i32
183+
elements := array random_test_size _->random.env.next_i32
184184

185185
pq_make := container.Binary_Heap_Queue m i32 .min_first_from elements
186186
pq_add := container.Binary_Heap_Queue m i32 .empty_min_first
@@ -229,11 +229,11 @@ priority_queue_test =>
229229

230230
for sort list i32 := nil, new_sort
231231
i in 1..test_size
232-
enq := true, (random.next_i32 100) < enq_rate
232+
enq := true, (random.env.next_i32 100) < enq_rate
233233
do
234234
new_sort :=
235235
if enq
236-
e := random.next_i32 test_size
236+
e := random.env.next_i32 test_size
237237
yak "🡩"
238238
q.enqueue e
239239
(sort ++ [e]).sort.as_list

0 commit comments

Comments
 (0)