Import the following attachment.
I changed
js code:
Result = Math.round((Math.random()*Sides)+1);
The round() method rounds a number to the nearest integer.
to
js code:
Result = Math.floor((Math.random()*Sides)+1);
The floor() method returns the value of a number rounded DOWNWARDS to the nearest integer.
Now with your 2 tests it returns each more randomly.
Throwing 20 Dices with 2 Sides each:
1. Dice: 1
2. Dice: 1
3. Dice: 2
4. Dice: 1
5. Dice: 1
6. Dice: 1
7. Dice: 2
8. Dice: 1
9. Dice: 2
10. Dice: 1
11. Dice: 2
12. Dice: 2
13. Dice: 1
14. Dice: 1
15. Dice: 2
16. Dice: 1
17. Dice: 1
18. Dice: 2
19. Dice: 1
20. Dice: 1
Throwing 20 Dices with 4 Sides each:
1. Dice: 2
2. Dice: 4
3. Dice: 3
4. Dice: 1
5. Dice: 3
6. Dice: 1
7. Dice: 2
8. Dice: 3
9. Dice: 2
10. Dice: 1
11. Dice: 4
12. Dice: 1
13. Dice: 1
14. Dice: 3
15. Dice: 4
16. Dice: 1
17. Dice: 4
18. Dice: 3
19. Dice: 2
20. Dice: 2
Enjoy