bug or something odd

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
mondo
Cave Troll
Posts: 69
Joined: Sun Jun 15, 2008 3:57 am

bug or something odd

Post by mondo »

1. I've noticed in recent months over several different recent versions a die roll issue.
We are having multiple incidences where multiple rolls in a roll are identical. It will always be the same person (whom ever it happens to) and will be several rolls in a row. (really stands out on 1d20 rolls). Two, three, and sometimes even 4 in a row. The odds are immense that it happens at all. But it occurs multiple times a session. Happens to anyone but occurs with one persons rolls. Ie If I roll and someone else rolls no identical. But if I make a few in a roll yes. (example). Happens with many dice but seems the d20 is more common or just more noticeable

2. yes happens with macros and with mods.

Thanks,

Mondo

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: bug or something odd

Post by aliasmask »

There's a 5% chance that any d20 roll will be duplicated on the next roll. (20 matches / 400 options)

Also, a small test.

Code: Select all

[H: counter = 0]
[H, c(100), code: {
   [H: lastRoll = 0]
   [H, c(1001), code: {
      [H: roll = 1d20]
      [H, if(lastRoll && lastRoll == roll): counter = counter +1]
      [H: lastRoll = roll]
   }]
}]
[R: strformat("%5.2f%%",counter/1000)]
After running this 5 times I get from 4.99% to 5.06% I say there could be a small bias, but it's only as much as an extra 6 times in 1000 rolls.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: bug or something odd

Post by Full Bleed »

mondo wrote:
Sat Jul 03, 2021 12:00 pm
1. I've noticed in recent months over several different recent versions a die roll issue.
We are having multiple incidences where multiple rolls in a roll are identical. It will always be the same person (whom ever it happens to) and will be several rolls in a row. (really stands out on 1d20 rolls). Two, three, and sometimes even 4 in a row. The odds are immense that it happens at all. But it occurs multiple times a session. Happens to anyone but occurs with one persons rolls. Ie If I roll and someone else rolls no identical. But if I make a few in a roll yes. (example). Happens with many dice but seems the d20 is more common or just more noticeable

2. yes happens with macros and with mods.
Are they actually rolling 4 times in a row OR getting the same roll 4 rounds in a row after perhaps dozens of rolls have happened in between their rolls?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: bug or something odd

Post by taustinoc »

Full Bleed wrote:
Sat Jul 03, 2021 2:49 pm
Are they actually rolling 4 times in a row OR getting the same roll 4 rounds in a row after perhaps dozens of rolls have happened in between their rolls?
It doesn't actually make a difference if the psuedo-random number generator is working right (and all evidence that I've seen says it is).

The chance of any two d20 rolls being the same, regardless of how many rolls are in between, is 5%. The chance of any three rolls being the same is 5% x 5%, or 1 in 400. Four in a row would be 1 in 8,000. Very rare, but if you roll enough times, it will happen (about one time in 8,000 rolls, in fact).

Random probability is very non-intuitive, largely because we only notice the odd results.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: bug or something odd

Post by wolph42 »

and yet, i know the feeling, Ive tested it also many times and never ever anything strange happened during testing, but ocassionally during gameplay it 'appears' that quite often the same number is rolled. Which made me wonder whether it coulnd't be some caching issue, which would be insanely hard to test for. But there is one way to get a reasonble idea and that is to add a 'random reference number' e.g. next to you 1d20 roll ALSO do a 1d1000 roll in the macro (make it light gray and small). Now should the double or triple happen again then if the d10000 is the same as well you know you have an issue, else you know it was just chance.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: bug or something odd

Post by Full Bleed »

taustinoc wrote:
Sat Jul 03, 2021 6:12 pm
Random probability is very non-intuitive, largely because we only notice the odd results.
Which is the point I was, likely, going to get to.

But if they are actually seeing triple or quadruple identical consecutive rolls "multiple times a night" then it's probably not just a case of "noticing odd results." It's probably something else, like the fact that they might not actually be seeing consecutive rolls to begin with... and I wanted to give them the chance to consider all the additional hits to the randomizer that might be going on in between those rolls.

Or maybe there is an issue with their framework...

Because, I've been gaming a long time... and I've never seen 4 identical consecutive d20 rolls in my life. So if these folks are seeing it multiple times a night something *is* wrong... it's just probably not MT's randomizer.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

mondo
Cave Troll
Posts: 69
Joined: Sun Jun 15, 2008 3:57 am

Re: bug or something odd

Post by mondo »

sorry for delay in response.

Yes its getting the same die roll several times. Like 2 or 3 attacks with the same roll. OR several skill checks (diff skill) getting same roll. it seems to be 2 or 3 times. It happens way too much to be luck. It happens to more than one person. Its also not all the time. For example playing just before typing this one person got 2 20"s in a row, another got 2 6's (d20) in a row and I rolled a 3 on 2d6 twice in a row. Then things seem to go back random. Its almost like a randomish bug.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: bug or something odd

Post by aliasmask »

mondo wrote:
Fri Jul 09, 2021 8:37 pm
sorry for delay in response.

Yes its getting the same die roll several times. Like 2 or 3 attacks with the same roll. OR several skill checks (diff skill) getting same roll. it seems to be 2 or 3 times. It happens way too much to be luck. It happens to more than one person. Its also not all the time. For example playing just before typing this one person got 2 20"s in a row, another got 2 6's (d20) in a row and I rolled a 3 on 2d6 twice in a row. Then things seem to go back random. Its almost like a randomish bug.
I know with the pf/3.5 attack macro I actually roll 3 times, 1 for attack and 2 alt rolls. So, if I'm getting seemingly duplicate rolls it's for every 3rd roll so it couldn't be related to the RNG. You could do the same, just roll a couple of extra dice and randomly pick one of those if you feel the RNG is wonky. This is mostly to make you feel better than actually do anything.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: bug or something odd

Post by Full Bleed »

mondo wrote:
Fri Jul 09, 2021 8:37 pm
Yes its getting the same die roll several times. Like 2 or 3 attacks with the same roll. OR several skill checks (diff skill) getting same roll. it seems to be 2 or 3 times. It happens way too much to be luck. It happens to more than one person. Its also not all the time. For example playing just before typing this one person got 2 20"s in a row, another got 2 6's (d20) in a row and I rolled a 3 on 2d6 twice in a row. Then things seem to go back random. Its almost like a randomish bug.
It's hard to gauge your issue... but none of the results you just mentioned are particularly unlikely or indicative of a bug. Show me multiple 3-in-a-rows or 4-in-a-rows and you've got a problem or a once in a lifetime session.

I mean, you could make MT re-roll all doubles if you want, but then you're actually messing with distribution. It might make your player's feel better though. You could even make MT fill in a perfect distribution chart... like a deck of cards where only one of a roll could be done in 20 rolls. Then, reshuffle the "deck" once all 20 numbers have been drawn. That would eliminate doubles and distribution variance (btw, that may sound facetious... it's not. In fact, I think it might be kind of fun... kind of like a mini-game where you're looking at who gets the best draw in any given cycle. :))

Otherwise, you have to live with "random" results like I illustrate below...

Here is a distribution chart of one NPC in our game and one PC. The "a" rolls are Auto rolls (MT's RNG) the "m" rolls are rolls they got with their own dice. You can hover on each total and see what the roll distribution is. If this case I'm hovering on the "a" rolls in "All" section because it's a combination of all attacks, skills, init rolls, and saves. As you can see, there is nothing particularly unusual. On approximately 600 rolls, one is .13 under the statistical average the other is .16 over. In fact, MT's rolls are far more statistically "correct" than the manual rolls. Are the real dice broken? ;)

Image

Doing this level of recording has calmed players who assume that MT's RNG is out to get them or jacked-up in some way. But if you were to take the lowest occurrence of a particular result and put that in 20's and the highest occurrence and put that in 1's, then the players would assume that MT's RNG was broken and no amount of statistical evaluation would convince a player otherwise. They could not possibly get (18) 20's against (39) 1's on 600 rolls without MT being horrendously out-of-whack. ;)

At any rate, I can't tell you that Java's randomizer is perfect. I can say that you can easily do your own 10000 roll tests and see that it's working as expected... and my "real world" roll recording seems to indicate efficacy as well.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
metatheurgist
Dragon
Posts: 363
Joined: Mon Oct 26, 2009 5:51 am

Re: bug or something odd

Post by metatheurgist »

So, just going to add my experience, not saying one thing or another. :wink:

I write a looooot of d20 attack macros. As a result I test a looooot of d20 attack macros. Just a lot of time pressing 'attack' and seeing the result. Now, a lot of times I keep pressing til a crit happens so I can check the crit is responding correctly. Now, a smart person would just adjust the code so it crits on a 10 (in fact, in my attack macros, it's data driven so I don't even have to change any code :wink: :wink: ) but no one ever accused me of being smart.

So here I am rolling regularly and I keep noticing the code for auto-miss miss keeps coming up many, many, many times before I can finish verifying my attack works completely. :wink: :wink: :wink:

But I'm sure I'm just remembering the 'bad' times. :P

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: bug or something odd

Post by taustinoc »

Has the random number function changed in the newer versions of Java?

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: bug or something odd

Post by taustinoc »

In the interest of actually having half a clue, I threw together a quick macro to roll millions (total of 6,000,000) of d20 rolls and track the results. All 20 possible results are within two one hundredths of one percent of what theory predicts:

Result Number Percent
1 299044 4.98%
2 300497 5.01%
3 300860 5.01%
4 298929 4.98%
5 299406 4.99%
6 300130 5.00%
7 299798 5.00%
8 299971 5.00%
9 299771 5.00%
10 299887 5.00%
11 300667 5.01%
12 299881 5.00%
13 300036 5.00%
14 300641 5.01%
15 300038 5.00%
16 300885 5.01%
17 300970 5.02%
18 299982 5.00%
19 298737 4.98%
20 299870 5.00%

At this point, my first suspicion is the macros producing the skewed results. Another thought - and probably not a good one - is to wonder if Java's pseudo-random number generator relies on some feature of the operating system. The above was done on Windows 7, for what it's worth. If anyone wants to try this on a different OS, the macro is below. It takes a long time.

Code: Select all

[h:r1=0]
[h:r2=0]
[h:r3=0]
[h:r4=0]
[h:r5=0]
[h:r6=0]
[h:r7=0]
[h:r8=0]
[h:r9=0]
[h:r10=0]
[h:r11=0]
[h:r12=0]
[h:r13=0]
[h:r14=0]
[h:r15=0]
[h:r16=0]
[h:r17=0]
[h:r18=0]
[h:r19=0]
[h:r20=0]

[h:setMaxLoopIterations(5000000)]

[h,COUNT(5000000), CODE: 
{
[h: Roll = 1d20]
[switch(Roll):
	case 1: r1 = r1 + 1;
	case 2: r2 = r2 + 1;
	case 3: r3 = r3 + 1;
	case 4: r4 = r4 + 1;
	case 5: r5 = r5 + 1;
	case 6: r6 = r6 + 1;
	case 7: r7 = r7 + 1;
	case 8: r8 = r8 + 1;
	case 9: r9 = r9 + 1;
	case 10: r10 = r10 + 1;
	case 11: r11 = r11 + 1;
	case 12: r12 = r12 + 1;
	case 13: r13 = r13 + 1;
	case 14: r14 = r14 + 1;
	case 15: r15 = r15 + 1;
	case 16: r16 = r16 + 1;
	case 17: r17 = r17 + 1;
	case 18: r18 = r18 + 1;
	case 19: r19 = r19 + 1;
	case 20: r20 = r20 + 1;

	default: "you entered a number not equal to 1 or 2"
]

}]

[r:"1 = " + r1]<BR>
[r:"2 = " + r2]<BR>
[r:"3 = " + r3]<BR>
[r:"4 = " + r4]<BR>
[r:"5 = " + r5]<BR>
[r:"6 = " + r6]<BR>
[r:"7 = " + r7]<BR>
[r:"8 = " + r8]<BR>
[r:"9 = " + r9]<BR>
[r:"10 = " + r10]<BR>
[r:"11 = " + r11]<BR>
[r:"12 = " + r12]<BR>
[r:"13 = " + r13]<BR>
[r:"14 = " + r14]<BR>
[r:"15 = " + r15]<BR>
[r:"16 = " + r16]<BR>
[r:"17 = " + r17]<BR>
[r:"18 = " + r18]<BR>
[r:"19 = " + r19]<BR>
[r:"20 = " + r20]<BR>

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: bug or something odd

Post by Full Bleed »

taustinoc wrote:
Sun Jul 11, 2021 1:49 pm
At this point, my first suspicion is the macros producing the skewed results. Another thought - and probably not a good one - is to wonder if Java's pseudo-random number generator relies on some feature of the operating system. The above was done on Windows 7, for what it's worth. If anyone wants to try this on a different OS, the macro is below. It takes a long time.
You left off the percentage calc in your posted code... so I went in to add that and made some other changes. Most notably I put in counts for consecutive rolls, as that was the core concern/claim of the OP.

My results show that there is nothing unusual. So the OP's macros are busted, or this is a case of selective perception (which would not be unusual amoung RPG players.)

In fact, the 1 in 8000 number for four in a row was exactly the number MT hit on my first 1 Million roll test: 125 occurrences.

consec roll results.jpg
consec roll results.jpg (183.36 KiB) Viewed 8775 times
And here's the updated roll test:

Code: Select all

[h: time = json.get(getInfo("client"), "timeDate")]
[h: broadcast("<i>Start Time: "+ time + "</i>")]

[h:r1=0]
[h:r2=0]
[h:r3=0]
[h:r4=0]
[h:r5=0]
[h:r6=0]
[h:r7=0]
[h:r8=0]
[h:r9=0]
[h:r10=0]
[h:r11=0]
[h:r12=0]
[h:r13=0]
[h:r14=0]
[h:r15=0]
[h:r16=0]
[h:r17=0]
[h:r18=0]
[h:r19=0]
[h:r20=0]

[h: repeatRoll = 0]
[h: inARow = 0]
[h: twoInARowCount = 0]
[h: threeInARowCount = 0]
[h: fourInARowCount = 0]
[h: fiveInARowCount = 0]
[h: sixInARowCount = 0]
[h: roll = 0]
[h: inARow = 1]

[h: input("Rolls")]

[h: setMaxLoopIterations(rolls)]

[h, COUNT(rolls), CODE: 
	{
		[h: previousRoll = roll]
		[h: roll = 1d20]
		
		[h, if(previousRoll == roll), CODE:
			{
				[h: inARow = inARow + 1)]
				[h: twoInARowCount = if(inARow == 2, twoInARowCount+1, twoInARowCount)]
				[h: threeInARowCount = if(inARow == 3, threeInARowCount+1, threeInARowCount)]
				[h: fourInARowCount = if(inARow == 4, fourInARowCount+1, fourInARowCount)]
				[h: fiveInARowCount = if(inARow == 5, fiveInARowCount+1, fiveInARowCount)]
				[h: sixInARowCount = if(inARow == 6, sixInARowCount+1, sixInARowCount)]
			};
			{
				[h: inARow = 1]
			}
		]
		
		[switch(Roll):
			case 1: r1 = r1 + 1;
			case 2: r2 = r2 + 1;
			case 3: r3 = r3 + 1;
			case 4: r4 = r4 + 1;
			case 5: r5 = r5 + 1;
			case 6: r6 = r6 + 1;
			case 7: r7 = r7 + 1;
			case 8: r8 = r8 + 1;
			case 9: r9 = r9 + 1;
			case 10: r10 = r10 + 1;
			case 11: r11 = r11 + 1;
			case 12: r12 = r12 + 1;
			case 13: r13 = r13 + 1;
			case 14: r14 = r14 + 1;
			case 15: r15 = r15 + 1;
			case 16: r16 = r16 + 1;
			case 17: r17 = r17 + 1;
			case 18: r18 = r18 + 1;
			case 19: r19 = r19 + 1;
			case 20: r20 = r20 + 1;

			default: "you entered a number not equal to 1 or 2"
		]
	}
]

[h: broadcast(
"<u><b>" + rolls + " d20 Roll Results:</b></u><br>"+
"1 = " + r1 + " (" + round(r1/rolls*100, 2) + "%)<br>" +
"2 = " + r2 + " (" + round(r2/rolls*100, 2) + "%)<br>" +
"3 = " + r3 + " (" + round(r3/rolls*100, 2) + "%)<br>" +
"4 = " + r4 + " (" + round(r4/rolls*100, 2) + "%)<br>" +
"5 = " + r5 + " (" + round(r5/rolls*100, 2) + "%)<br>" +
"6 = " + r6 + " (" + round(r6/rolls*100, 2) + "%)<br>" +
"7 = " + r7 + " (" + round(r7/rolls*100, 2) + "%)<br>" +
"8 = " + r8 + " (" + round(r8/rolls*100, 2) + "%)<br>" +
"9 = " + r9 + " (" + round(r9/rolls*100, 2) + "%)<br>" +
"10 = " + r10 + " (" + round(r10/rolls*100, 2) + "%)<br>" +
"11 = " + r11 + " (" + round(r11/rolls*100, 2) + "%)<br>" +
"12 = " + r12 + " (" + round(r12/rolls*100, 2) + "%)<br>" +
"13 = " + r13 + " (" + round(r13/rolls*100, 2) + "%)<br>" +
"14 = " + r14 + " (" + round(r14/rolls*100, 2) + "%)<br>" +
"15 = " + r15 + " (" + round(r15/rolls*100, 2) + "%)<br>" +
"16 = " + r16 + " (" + round(r16/rolls*100, 2) + "%)<br>" +
"17 = " + r17 + " (" + round(r17/rolls*100, 2) + "%)<br>" +
"18 = " + r18 + " (" + round(r18/rolls*100, 2) + "%)<br>" +
"19 = " + r19 + " (" + round(r19/rolls*100, 2) + "%)<br>" +
"20 = " + r20 + " (" + round(r20/rolls*100, 2) + "%)"
)]


[h: broadcast(
"<u><b>Consecutive Rolls:</b></u><br>"+
"Two in a Row: " + twoInARowCount + "<br>" +
"Three in a Row: " + threeInARowCount + "<br>" +
"Four in a Row: " + fourInARowCount + "<br>" +
"Five in a Row: " + fiveInARowCount + "<br>" +
"Six in a Row: " + sixInARowCount
)]

[h: time = json.get(getInfo("client"), "timeDate")]
[h: broadcast("<i>End Time: "+ time + "</i>")]
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: bug or something odd

Post by wolph42 »

well there's still the matter of potential caching, meaning that somehow a routine you run is cached and when you run it again its grabbed from memory with the same initial parameters. this would not happen with a single routine but could theoretically happend when you keep clicking the macro. Anyhoot I've added a 1d1000 as an extra line for all my macro roles to check whether this happens during game play. Give it a few months and we'll see if anything weird comes up

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: bug or something odd

Post by aliasmask »

I was thinking it could be due to programming, but I think if that was the case it would be more obvious. Something like getting your rolls from getRolled() and not clearing it between iterations. Now, if that happens only on fringe cases like rolling a nat 20 or 1 then it wouldn't be as obvious but it would always double up on the fringe case and that would seem obvious.

Post Reply

Return to “MapTool”