Skip to content

Commit 8cab422

Browse files
committed
Update crystal-ball evaluation to bound the random number with max
1 parent b65aaa7 commit 8cab422

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

benchmarks/arduino-crystal-ball/crytal-ball.ts renamed to benchmarks/arduino-crystal-ball/crystal-ball.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ let prevSwitchState: i32 = 0;
3131
let reply: i32;
3232

3333
function random(max: i32): i32 {
34-
//return Math.floor(Math.random() * max);
35-
return chip_analog_read(0);
34+
return chip_analog_read(0) % max;
3635
}
3736

3837
export function main(): void {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build:
2+
asc crystal-ball.ts -o upload.wasm --disable mutable-globals --disable sign-extension --disable nontrapping-f2i --disable bulk-memory --sourceMap --debug
23 Bytes
Binary file not shown.

benchmarks/arduino-crystal-ball/upload.wasm.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)