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:
Goomba
New Member
*


Posts: 6
Joined: Oct 2007
O.P. It seems the tDice script hates 1.
I've been using the tDice script for a looong time now, and just now I have realized that it's rare that 1 is rolled. If you roll a series of die with 2 sides, it will most likely get 2, like this sequence I have rolled.

Throwing 20 Dices with 2 Sides each:
1. Dice: 2
2. Dice: 2
3. Dice: 2
4. Dice: 2
5. Dice: 2
6. Dice: 2
7. Dice: 2
8. Dice: 2
9. Dice: 2
10. Dice: 2
11. Dice: 2
12. Dice: 2
13. Dice: 2
14. Dice: 2
15. Dice: 2
16. Dice: 2
17. Dice: 2
18. Dice: 2
19. Dice: 1
20. Dice: 2

Now if you roll let's say, 1-4, you'll get something like this. (I JUST ROLLED THIS)

Throwing 20 Dices with 4 Sides each:
1. Dice: 4
2. Dice: 4
3. Dice: 3
4. Dice: 3
5. Dice: 4
6. Dice: 4
7. Dice: 4
8. Dice: 2
9. Dice: 4
10. Dice: 3
11. Dice: 3
12. Dice: 1
13. Dice: 2
14. Dice: 3
15. Dice: 4
16. Dice: 4
17. Dice: 2
18. Dice: 1
19. Dice: 3
20. Dice: 2

Only two 1s.

No, this is not just chance, I've done 10 die with 2 sides over 50 times, none of them had a majority of 1's, only 2's.

Is there any way to fix this script at all?
03-30-2009 03:54 AM
Profile E-Mail PM Find Quote Report
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 80 time(s).
03-30-2009 04:23 AM
Profile PM Find Quote Report
Goomba
New Member
*


Posts: 6
Joined: Oct 2007
O.P. RE: RE: It seems the tDice script hates 1.
THANKS!

You are quite the fellow.

This post was edited on 03-30-2009 at 10:19 PM by Goomba.
03-30-2009 10:19 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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