What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » It seems the tDice script hates 1.

It seems the tDice script hates 1.
Author: Message:
prashker
Veteran Member
*****


Posts: 5109
Reputation: 104
– / Male / –
Joined: Mar 2005
Status: Away
RE: It seems the tDice script hates 1.
Import the following attachment.

I changed

Javascript code:
Result = Math.round((Math.random()*Sides)+1);

The round() method rounds a number to the nearest integer.

to

Javascript 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 :)

.plsc File Attachment: tDiceEdit.plsc (1.69 KB)
This file has been downloaded 81 time(s).
03-30-2009 04:23 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
It seems the tDice script hates 1. - by Goomba on 03-30-2009 at 03:54 AM
RE: It seems the tDice script hates 1. - by prashker on 03-30-2009 at 04:23 AM
RE: RE: It seems the tDice script hates 1. - by Goomba on 03-30-2009 at 10:19 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On