8000 fix: D6 dice roll could produce 0 (#1337) · sveltejs/svelte.dev@600361d · GitHub
[go: up one dir, main page]

Skip to content

Commit 600361d

Browse files
authored
fix: D6 dice roll could produce 0 (#1337)
The Math.random() static method returns a floating-point, pseudo-random number that's greater than or equal to 0 and less than 1
1 parent 6f10dee commit 600361d

File tree

1 file changed

+1
-1
lines changed
  • apps/svelte.dev/content/tutorial/01-svelte/04-logic/06-await-blocks/+assets/app-a/src/lib

1 file changed

+1
-1
lines changed

apps/svelte.dev/content/tutorial/01-svelte/04-logic/06-await-blocks/+assets/app-a/src/lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function roll() {
99
return;
1010
}
1111

12-
fulfil(Math.ceil(Math.random() * 6));
12+
fulfil(Math.floor(Math.random() * 6) + 1);
1313
}, 1000);
1414
});
1515
}

0 commit comments

Comments
 (0)
0