Sonny44
Sonny44
  • Threads: 13
  • Posts: 217
Joined: May 13, 2013
September 20th, 2014 at 9:28:16 AM permalink
By "mechanics," I mean what happens between the user, the software, servers, etc., when I start an online game. Say, several players start a game at the same time. Do they each get the same seed? Then, after the game starts, what determines the rolls? Say, there are thousands playing a game, not necessarily starting at the same time. How does the RNG handle that?

I suppose the RNG generates numbers by the millisecond. Maybe, since numbers are generated by the millisecond, the roll is determined when I hit the "Roll" button. So, there is no seed.

I also suppose the RNG runs on a server that runs 24/7.

I'm not a coder. All I'd like to know is when I start the Wiz's game, what is going on behind the scenes when it comes to the RNG, in ordinary, plain language, if that's possible. The "mechanics," IOW.
boymimbo
boymimbo
  • Threads: 17
  • Posts: 5994
Joined: Nov 12, 2009
September 20th, 2014 at 9:52:36 AM permalink
While I am not a coder either, I imagine that some sort of randomizer is going into his game, the complexity of which is only known to the person(s) that programmed the thing, which are likely high ranking members of this forum.
----- You want the truth! You can't handle the truth!
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
September 20th, 2014 at 10:10:25 AM permalink
I would guess the seed is set "once" (i.e. at boot time), and then letting run as random numbers are requested from the RNG. Re-seeding RNGs is most often not a good strategy, as it limits entropy of the RNG.

Of course you would choose a RNG with a very large period (larger than you could store), making it difficult to predict next numbers even if you know previous numbers.
Dieter
Administrator
Dieter
  • Threads: 16
  • Posts: 6122
Joined: Jul 23, 2014
September 20th, 2014 at 10:24:00 AM permalink
Quote: MangoJ

I would guess the seed is set "once" (i.e. at boot time), and then letting run as random numbers are requested from the RNG. Re-seeding RNGs is most often not a good strategy, as it limits entropy of the RNG.



I would guess that entropy is added as various external events trigger system interrupts (network, disk, etc).

I wouldn't expect that the server's system RNG is used directly as a randomness source for gaming purposes. (The Linux system RNG specifically runs out of entropy ("randomness") the more it's used - it gets more entropy as external events happen.)

I wouldn't be surprised if it was used to seed another RNG system, like a Mersenne Twister, which is constantly running, and that is used to determine game outcomes.


This is mostly supposition; I don't know how the system gets randomness sources for games, but I have a few guesses how I might design a similar system.
May the cards fall in your favor.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
September 20th, 2014 at 1:04:07 PM permalink
My statement was that whatever an RNG you use is set "once", and probably early. It doesn't mean you should use C-rand() or /dev/random. Even a Mersenne Twister you need to seed somewhere.

There is no need to reseed. At best you keep the entropy needed by the RNG, at worst you reduce your entropy. So why reseed ? You gain nothing by that, with a significant chance to make it worse.

For an individual game, there is enough entropy generated from the race of simultaneous games asking for the next random number.
ThatDonGuy
ThatDonGuy
  • Threads: 122
  • Posts: 6742
Joined: Jun 22, 2011
September 20th, 2014 at 1:29:26 PM permalink
Quote: Sonny44

I suppose the RNG generates numbers by the millisecond. Maybe, since numbers are generated by the millisecond, the roll is determined when I hit the "Roll" button. So, there is no seed.


As stated earlier, there has to be a initial value, even if it's zero. There was an exploit of an electronic keno game in Montreal about 20 years ago caused by the machine starting with the same seed when turned on. Typically, the seed is based on the date and time when it is initialized.

As for "by the millisecond", that is just asking to be exploited. Even "only" by the microsecond may not be fast enough; I have heard of people who can time this sort of thing to 100 microseconds. (A project I had in a computer hardware course 30 years ago was a pseudo-random dice roller - you hold down a button to "roll", and when you let go, two random numbers from 1-6 appeared; one was generated by cycling through 1-6 at 1 million numbers per second (I think the fastest speed of a 555 timer is 2 MHz), and the other cycled through 1-6 by changing every time the other number changed from 6 to 1.)
indignant99
indignant99
  • Threads: 2
  • Posts: 250
Joined: Feb 23, 2015
March 23rd, 2015 at 8:16:59 AM permalink
Quote: Sonny44

I suppose the RNG generates numbers by the millisecond.
I also suppose the RNG runs on a server that runs 24/7.


You have some fantasy speculation regarding RNG's.
A Random-Number-Generator is not constantly running, whirring, clanking in the background. It's dormant (with the next number poised to spit out), and when called upon, the RNG does, in fact, spit out that next number. It works like the next-number pull-off spool at the Deli counter or at the DMV. Except this spool is all mixed up.

A better analogy of the "seed" is that it chooses one of gazillions of spools (all different) from the back-warehouse room. Change the seed, then you swap in a different spool.

Now you could interpose another piece of software, between the "get me a random number" request and the actual RNG. It (the intermediary) could run continuously pulling numbers (while none are actually being requested), and it (the intermediary) could supply the currently-instantly available number when it (the intermediary) gets the "gimme" request. In this arrangement, the intermediary is "running, whirring, clanking" continuously, but not the RNG. The RNG is only spitting out its next number.

Whether it's the ultimate requestor of a number, or the frenzied "intermediary" requestor, the actual RNG is just giving the next number from its "spool."
Yeah, I made a mistake once. I thought I was wrong, when I actually wasn't. -Indignant
Sonny44
Sonny44
  • Threads: 13
  • Posts: 217
Joined: May 13, 2013
March 23rd, 2015 at 11:11:24 AM permalink
Quote: indignant99

You have some fantasy speculation regarding RNG's. A Random-Number-Generator is not constantly running, whirring, clanking in the background. It's dormant (with the next number poised to spit out), and when called upon, the RNG does, in fact, spit out that next number. It works like the next-number pull-off spool at the Deli counter or at the DMV. Except this spool is all mixed up. A better analogy of the "seed" is that it chooses one of gazillions of spools (all different) from the back-warehouse room. Change the seed, then you swap in a different spool.....


This helps a lot. Thanks. So, an RNG is simply a program w/in a program that "spits" out a random number when called upon. I checked RNGs on Wikipedia & there are over a dozen of them, the Mersenne twister, the best, which the Wiz game uses. I suppose these are available to developers for a price, altho another game I play uses a Java RNG, which is free. I don't know the RNG WinCraps uses, but I suspect it is the twister. I think what RNG a computer sim uses is very important in simming craps calculations/strategies.

BTW, the dice are "mechanical" RNGs. Right?
indignant99
indignant99
  • Threads: 2
  • Posts: 250
Joined: Feb 23, 2015
March 23rd, 2015 at 12:18:27 PM permalink
Quote: Sonny44

the Mersenne twister, the best, which the Wiz game uses.


Yes. And when you fire up the Wiz Sim, you get your own copy of the RNG, and your own seed. I get my own copy of the RNG and my own seed. We're not sharing any "community" RNG.
Quote: Sonny44

BTW, the dice are "mechanical" RNGs. Right?


Yes. Sometimes when the dealers ask my name, I lie "Randy," short for Random Number Generator.
Yeah, I made a mistake once. I thought I was wrong, when I actually wasn't. -Indignant
  • Jump to: