Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

Better random number generation

February 08 (12 years ago)

This gets pretty good distribution.

http://en.wikipedia.org/wiki/Mersenne_twister


February 08 (12 years ago)
IsItMyTurnYet
Marketplace Creator

They actually had a talk about this in the new supporter podcast. Tests were run, numbers were crunched and Roll20's random number generator is more than sufficient.

February 08 (12 years ago)

And yet, strangely, one of my players can never seem to roll above a 10 when shooting with a crossbow... it's become a running table gag because in 13 shots he's missed 11 times due to low rolls. Slightly better with other attack rolls.

February 08 (12 years ago)
Gauss
Forum Champion

Derek, assuming an RNG is a good one, RNGs do not provide the same distribution that real dice provide. This is due more to the fact that real dice do not have an equal distribution. 

For example, take the d20. Most of them have a short 10-11 axis which results in a a slightly higher distribution of 10s and 11s. Additionally, many dice are unintentionally weighted. 

Both can be tested for. A micrometer can be used to measure the axis length. On the d20 it should be short on the 10-11 axis and long on the 1-20 axis. 

To test weighting float the die in a saltwater solution. This may take an extreme amount of salt to get some dice to float (like, 1/4 of a gallon of epsom salt in a decent sized bowl). Spin the die in the water. If, at the end of its spin, it radically changes spin direction it is weighted. How fast it changes direction can be an indicator of just how weighted it is. A good d20 should not change direction at all. 

In any case, one of my players also seemed to roll low all the time. I told her she may roll like this: 21-1d20+bonuses. For a bit it seemed like that 'fixed' her problem. But it turns out it didnt, now she just 'rolls high' and gets poor numbers that way. 

- Gauss

February 08 (12 years ago)

You could control the distribution, such as with a deck of cards used as a d20, with faces and jokers removed. Where you shuffle, and then must go through the entire deck before reshuffle. This has its own problems, but you are guaranteed, outside of cheating, of getting as many twenties as one's. Just an illustration regardless.

February 09 (12 years ago)

Perhaps grant users the options to pick or implement their own RNG schemes in the settings with a dropdown?  Getting JS random() to be cryptographically secure is a feat in and of itself right off the bat, to be fair.

February 09 (12 years ago)

I always just tap up hit enter, tap up hit enter, and roll the dice like 5-10 times if I feel like I've had a bad losing streak, I always tell the DM I'm getting rid of 5 rolls, or something, so he knows before I actually roll. Seems to help in making it more random. Throwing some extra rolls in there. Just like when I roll my actual d20 once or twice when I'm not even doing anything. (I don't like to roll real dice a lot 'cause it can get annoying)

February 09 (12 years ago)

@GammaGoblinz You could just create a macro with five lines of /gmroll and include a /gm Bad roll clearing macro! at the start.

February 09 (12 years ago)

I use a 999d100 macro when i first get the vtt up.  Take the average, should be about on.  I have been down q "RNG" thread of my own, and basically, it is in our head if we see a "lack" of randomness because we interpret the results to be counter to our goal.  True randomness with a d20 is an equal chance per instance of each result, in this case 5%.  There is a 5 % chance of each result.  The previous event has no bearing on past or future events.  It is possible to roll 100 natural twenties in a row, to us this seems amazing, but to math it is a 5% chance each time, and only is spectacular cause we make it so.  We add every thing else on to it.  Anyways, true RNG requires a random source with which to draw from for seeding, making it exceedingly difficult.  As long as there is a baseline of "each instance has an equal chance of occurring", i think the RNG does alright.    Gauss is correct about the short axis.  I thought the d20 i got with my ADnD started box 20 years ago was magic...it was a Nattie 2=0 machine...come to find its the lack of a micron.   

February 09 (12 years ago)

You get those days where you never seem to win with your rolls with regular dice too. It's the nature of people to blame something else for random chance. People can forget that rolling the exact same thing has the same random chance as rolling better or worse. It all amounts to "do you feel lucky?"

My gaming group knows the random chance is random and yet we still make comments like "Oh you just wasted a crit" when rolling really good on something that doesn't critical. These complaints are part of the game and comradery too.

February 09 (12 years ago)

JonathanTheBlack said:

@GammaGoblinz You could just create a macro with five lines of /gmroll and include a /gm Bad roll clearing macro! at the start.

LoL! When I do it I tend to roll ridiculous dice, i'll do a 1d100 on session, maybe a 1d30 another session, maybe a 1d3 another session. I know it probably makes no difference but I feel like rolling varied dice types might help.

Also, I agree, every single roll can result in any of the sides, so rolling low a lot happens and is no less random than rolling high a lot, (once rolled a 1d20+10 against 7 targets and every result was over 22+)

It just tends to happen, random doesn't mean it's going to be up/down up/down up/down.

Haha, you never hear anyone complain about constantly rolling high and saying they want a new random generator 'cause they have nothing to complain about, but the minute they start consistently rolling low, all of a sudden the generator isn't rolling random enough. <---Food for thought.
February 09 (12 years ago)

RNG's aren't, neither are dice. This is why I like craps.  I rarely lose, even tho I never win big.  :)  RPG'ers know how to read dice.  

February 09 (12 years ago)

Prefer RNG over dice really. Perhaps the linear peeps may wish to consider RNGin' the bell instead. At least you would somewhat mitigate the wild results. As far as the 'broken RNG' plaintiffs ""Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a prettygirl for an hour, and it seems like a minute." Mark Twain

February 09 (12 years ago)
Gid
Roll20 Team

Eric ran our RNG through the paces set forth from dieharder several weeks back. It took four days to complete the testing if I recall. He'll get around to posting the results sooner rather than later, but our RNG is pretty darn good and should be more than satisfactory for rolling for RPGs.

February 10 (12 years ago)

How does it stand up when used with several dice at once. It seems the larger the dice pool (shadowrun) the less successes we get.

February 10 (12 years ago)
Riley D.
Roll20 Team

Kat9 said:

How does it stand up when used with several dice at once. It seems the larger the dice pool (shadowrun) the less successes we get.

The size of the dice pool does not affect it. To the system each roll is independent, it doesn't matter if your /roll 10d6 or /roll 1d6 ten times in a row.

February 11 (12 years ago)

Yeah I've had mass successes, and mass failures, it's random. You could potentially roll 10 1's in a row. Like I said, no one ever complains about an RNG when they're constantly rolling high, only when they constantly roll low.

February 11 (12 years ago)

Devs...

Is it possible that you could share the high-level synopsis of your RNG methodology?

If not... if I were to code a generator factory that allowed different methodologies to be selected by the user in Ruby (I'm assuming you guys are using Ruby because of Paperclip) whats the chances your team would review it?

February 11 (12 years ago)

I just played in my first session of a new game on Friday and ended up with something like 5/6 consecutive rolls that were 20s. It was annoying the other players and made me feel guilty for my "luck."

February 11 (12 years ago)
Wayne T.
KS Backer
Compendium Curator

Just played our very first session using Roll20 and it seemed totally random to me.  I didn't feel like anyone was getting a string of anything, high or low. 

February 11 (12 years ago)

My players were getting a lot of 20s tonight. My monsters took a pretty bad beating from being critically hit so much. Even still, the dice roller seems to be pretty good at randomizing #s. Real randomness will certainly include strings of the same # coming up back to back a few times over the course of many rolls.

February 11 (12 years ago)
Eric D.
KS Backer

Ok, lets everyone go take a look at: http://app.roll20.net/forum/post/63487/from-the-source-roll20-rng-testing/#post-63487

Patrick R. said:

Perhaps grant users the options to pick or implement their own RNG schemes in the settings with a dropdown?  Getting JS random() to be cryptographically secure is a feat in and of itself right off the bat, to be fair.

Roll20 doesn't use JS Math.random() partially for this reason, the RNG behavior is not defined by the language spec and varies based on browser and OS. Roll20 does use a cryptographically secure RNG that does provide an even distribution and even accounts for modulo bias when generating random integers in a specified range (like for rolling dice). The initial RNG seed comes from an external source of high-quality random data as well.