delphi12 0 Posted December 19, 2006 Share Posted December 19, 2006 I think its also important to note that "shuffling" is a term that can only be used in terms of physical items. In reality, shuffling and randomly picking are the same thing. I don't care what any "expert" who has written a paper on it says. I won't accept it. They are one in the same in terms of computer programming. Link to post Share on other sites

qyayqi 11 Posted December 19, 2006 Share Posted December 19, 2006 i've read more closely how pokerstars works their rng, and it appears to do reduce the bias of a traditional rng.computers work with bits. lets presume a small rng. each time you call it, it returns 4 bits (to represent values 0-15) assumed to be random every time. we want a random number between 1 and 3.rand(1,3) is most often dealt with in this fashion by a rng:4-bit value.........1-3 value0000=00.............10001=01.............20010=02.............30011=03.............10100=04.............20101=05.............30110=06.............10111=07.............21000=08.............31001=09.............11010=10.............21011=11.............31100=12.............11101=13.............21110=14.............31111=15.............1this trivial example shows that 2 and 3 would be returned 5 times, 1 would be returned 6 times. in a 3-card deck, you'd be seeing more aces than 2's or 3's.another exaggeration would be to use a 6-bit value to generate random card draws. 6 bits give you the numbers 0-63. with 52 cards, the first 12 cards would appear twice as often as the other cards-- numbers 0-51 cover the deck, then 52-63 repeat cards 1-12.with prolonged use, delphi's blackjack using a vanilla rng will display a bias toward the first few cards. this bias becomes smaller as the number of bits in the rng is increased, but it still exists. that is, instead of 5 versus 6 in the first example, it could be 21845 versus 21846 (16-bit rng).to grab the next random number & pick the card, you are in no way dealing with the bias. you're assuming it is sufficiently small.pokerstars handles it by handling the rng as a bitstream. they take 6 bits, and if it is >52 they discard it and get another 6 bits.paradise handles it with a 10x shuffle and a 31-bit rng with 2016-bit seed.i prefer the paradise method. 6-handed, ps uses 17 random numbers to 'shuffle up and deal' (pull 2 cards for each player and 5 board cards). paradise uses approx 520 random numbers to do it. regardless of how 'perfect' they claim their rng is, 520 numbers will reduce trace bias much more effectively than 17. safety in numbers.<shrug> but i could be wrong.edit :: yes, storing the whole deck could be incorrect. they may simply store the top x cards sufficient to deal the hand after shuffling.edit 2 :: if shuffling and random picks are the same, casinos can stop shuffling the cards and simply deal out random picks from the pile. but they don't. people work on the mathematics of a 'good' versus 'bad' computer shuffle to handle similar problems of a bad physical shuffle-- ie, cards clumping together. Link to post Share on other sites

Actuary 3 Posted December 19, 2006 Share Posted December 19, 2006 qy,um... it's hard to argue with someone that uses a lot of fancy computer terms old guys don't know; but if a dealer were to randomly select cards from a deck, yes, it would be as "random" as a shuffle (aside from the fact humans can't really pick randomly, but pretend) You really think the reason casinos don't do that is because shuffling mixes them up more? Well, yeah, the deck is mixed up; but a far as the cards dealt, they are as random, no? Of course it's tough for humans to really select randomly; but a computer program picking numbers 1-52 randomly is just as random as "computer shuffling" the deck.Also, that HAS TO be wrong on your idea of 1-3, selecting 1 one more time than 2/3 out of 16. Any decent uniform RNG can be applied to any finite number of values and result in a long term uniform distibution of those valueI guess I'm limited by the actual working of a computer, logically though, your rationale is perplexing. Link to post Share on other sites

qyayqi 11 Posted December 19, 2006 Share Posted December 19, 2006 um... it's hard to argue with someone that uses a lot of fancy computer terms old guys don't know; but if a dealer were to randomly select cards from a deck, yes, it would be as "random" as a shuffle (aside from the fact humans can't really pick randomly, but pretend) You really think the reason casinos don't do that is because shuffling mixes them up more? Well, yeah, the deck is mixed up; but a far as the cards dealt, they are as random, no? Of course it's tough for humans to really select randomly; but a computer program picking numbers 1-52 randomly is just as random as "computer shuffling" the deck.Also, that HAS TO be wrong on your idea of 1-3, selecting 1 one more time than 2/3 out of 16. Any decent uniform RNG can be applied to any finite number of values and result in a long term uniform distibution of those valueI guess I'm limited by the actual working of a computer, logically though, your rationale is perplexing.the 1-3 isn't wrong, it is simplified to make the problem easy to spot. a 4-bit rng would be only useful in situations where you want a number 1-2, 1-4, 1-8, or 1-16 (equally divide into 16, so no extra values to cause bias). rng's are now in the 32-64 bit and higher range as computers have advanced. as the bit count increases, the error becomes "sufficiently" small where programmers will ignore it.computers are like gam-booleans, they only know two things. 0 or 1 for computers; all in or fold for gam-booleans. from this, it is difficult to make anything truly random. if it was easy, they wouldn't need to keep looking for a better shuffling algorithm.i really don't have much else to say on it. i thought the table was straight-forward enough to see what the problem is, and from it i explained where a couple sites sit on how to make things random. in most instances, as with most computer things, people will assume it works well enough to get the job done and be satisfied.(if the deck is set up AKQJT98765432 and there are slightly more a-9 showing up per day, who is going to complain? people like bigger hands, and it can result in marginally more money being wagered for the online site. this is in no way related to the lee-ver [copyright 2003 pokerstars] pulled by pokerstars to generate bad beats.)EDIT :: while you do your experiment, i'll note that pulling cards out of the deck to deal has the same problem as a bad rng picking cards. what if the dealer is lazy and always puts all the dealt cards back on top and deals those off as his picks? or always picks from near the middle while returning dealt cards to the top? the first case is extreme, the 2nd could happen. now the players know two things: the bottom half of the cards will never be reached, and the cards they just saw won't come around again until the dealer goes through half the deck. a bad rng could be hitting certain cards more frequently. shuffling in casinos is done a certain way to try to get the cards as random as possible. shuffling algorithms perform the same task.EDIT 2 :: anecdotal evidence of badly designed shufflingOnce, there was an online casino that offered texas holdem games. They thought they were being slick by posting the shuffle code for folks to see. What they did not realize was that there was a pretty hefty bug in their code, so that instead of 52! (about 8*10^67) possible shuffled decks of cards, they had about 5000. As a result, players could determine in 5 cards (or less) what the deck was (thus knowing the position of all 52 cards in that deck), and what they should bet.EDIT 3 :: pseudo-code for shuffling:Assume 52 cards.for I = 0 to 50 J <- Pick a random number between I and 51 Swap item in position I with item in position JThe quality of the shuffle depends on the quality of your random number generator.note the last line. i used double-shuffling in mirc using the above to offset any weakness in mirc's rng. doing more than that took too long because mirc script is not exactly fast at this type of application. Link to post Share on other sites

Actuary 3 Posted December 19, 2006 Share Posted December 19, 2006 give me a few minutes...doing a quick experiment... Link to post Share on other sites

delphi12 0 Posted December 19, 2006 Share Posted December 19, 2006 i've read more closely how pokerstars works their rng, and it appears to do reduce the bias of a traditional rng.computers work with bits. lets presume a small rng. each time you call it, it returns 4 bits (to represent values 0-15) assumed to be random every time. we want a random number between 1 and 3.rand(1,3) is most often dealt with in this fashion by a rng:4-bit value.........1-3 value0000=00.............10001=01.............20010=02.............30011=03.............10100=04.............20101=05.............30110=06.............10111=07.............21000=08.............31001=09.............11010=10.............21011=11.............31100=12.............11101=13.............21110=14.............31111=15.............1this trivial example shows that 2 and 3 would be returned 5 times, 1 would be returned 6 times. in a 3-card deck, you'd be seeing more aces than 2's or 3's.Impressive.. Now we are starting to talk my language. In the above example, it absolutely is not trivial that 1 shows up more often and you would obviously regenerate a random number when 15 (or 0) came to not allow that. Its similar to what one of your other examples showed. I'm just saying that if you can get a true random number from 1-52, that is EXACTLY the same as "shuffling" the deck no matter how many times you do it in order to create some sort of "randommess" that the sites seemed to claim they are doing. Link to post Share on other sites

qyayqi 11 Posted December 20, 2006 Share Posted December 20, 2006 Impressive.. Now we are starting to talk my language. In the above example, it absolutely is not trivial that 1 shows up more often and you would obviously regenerate a random number when 15 (or 0) came to not allow that. Its similar to what one of your other examples showed. I'm just saying that if you can get a true random number from 1-52, that is EXACTLY the same as "shuffling" the deck no matter how many times you do it in order to create some sort of "randommess" that the sites seemed to claim they are doing.1) if you can get a true random number from 1-52, that is EXACTLY the same as "shuffling" the deck.2) computer rng's are pseudo-random, if you know the formula you can predict the next number; therefor they are not true random.3) computer random picks are not the same as shuffling.i feel like i'm arguing minbets & have to keep repeating myself. Link to post Share on other sites

Actuary 3 Posted December 20, 2006 Share Posted December 20, 2006 3) computer random picks are not the same as shuffling.i feel like i'm arguing minbets & have to keep repeating myself.I'm smart guyWhen you shuffle, you slect cards to put 1st, 2nd, 3rd..erc, right?How is that more mixed up than picking them as you need them?One day, I'll look more lcosely at a simple rng (EXCEL) to see how uniform and random it really is (as if I could tell... I did some testing and saw the values appear uniformally with normal tolerances, at least)EDIT: oh, you mean human? shuffling <> Computer Random, ok... true Link to post Share on other sites

qyayqi 11 Posted December 20, 2006 Share Posted December 20, 2006 i surrender. y'all are right and i am wrong. i am currently writing letters to all the poker sites telling them to stop developing shuffle algorithms & rng's because the rng in any computer is good enough and random picks are sufficient. i'm including a link to this thread so they can see how badly they've wasted their money. Link to post Share on other sites

Actuary 3 Posted December 20, 2006 Share Posted December 20, 2006 i surrender. y'all are right and i am wrong. i am currently writing letters to all the poker sites telling them to stop developing shuffle algorithms & rng's because the rng in any computer is good enough and random picks are sufficient. i'm including a link to this thread so they can see how badly they've wasted their money.I do not mean to imply that EXCEL rng is sufficientOnly saying its not as biased as your 0-15 1-3 mapping example, so I"m perty sure poker sites can make effectively random/uniform rngsAnd, you could try to explain why having the deck preshuffled is better than ad hoc random card selecting, from a computers point of view Link to post Share on other sites

qyayqi 11 Posted December 20, 2006 Share Posted December 20, 2006 I do not mean to imply that EXCEL rng is sufficientOnly saying its not as biased as your 0-15 1-3 mapping example, so I"m perty sure poker sites can make effectively random/uniform rngsAnd, you could try to explain why having the deck preshuffled is better than ad hoc random card selecting, from a computers point of viewof course it isn't as biased as my mapping. i simplified it to make the problem obvious.i did explain. i accepted delphi's premise that a perfect rng would make random selection work. and i explained the problems a computer has generating random numbers. and then explained that a well-constructed shuffling algorithm will reduce the impact of the weak rng.i accepted that pokerstars has done ALOT to create something approaching a true rng to make their random selection work. and also pointed out how paradise approached the problem by using multiple shuffles to reduce the bias in their possibly slightly weaker rng.no, i cannot explain the exact math used to prove how shuffling more than once reduces bias. in simplistic terms, if there is a 5% bias in the shuffled deck and you shuffle twice, .05x.05=.025 bias. 2.5% now. the reason i prefer the paradise version is because they accept that ultimately a computer has a very hard time being truly random. an rng is a mathematical formula performed by the computer which includes a seed value-- usually an ititial starting seed, then each successive iteration uses the previous result to generate the next. ie:int rand() { random_seed = random_seed * 1103515245 +12345; return (unsigned int)(random_seed / 65536) % 32768; } varying the seed with real-world randomness increases the strength of the rng. ie: You can create some sort of device that monitors a completely random natural event and sends its results to the computer. For example, you could place a piece of radioactive material in front of a Geiger counter and connect the Geiger counter to a computer. Since radioactive decay is random, the Geiger counter would create truly random numbers. This approach is pretty rare, because not many people have Geiger counters connected to their machines.for excel, we're talking about sufficiently random. for poker sites that have people wagering real money & some players mathematically-advanced enough to spot and take advantage of a weaker rng, more is needed.just received a response!if the rng in a computer was sufficient, pokerstars wouldn't have to:Let's cover that in detail, step by step, from the "Shuffle Highlights" section:> We use 249 random bits from both entropy sources (user input and > thermal noise) to achieve an even and unpredictable statistical > distribution. So, to shuffle a hand, we take 249 truly random bits from the thermal source, and 249 truly random bits from the aggregate mouse movements --two truly random (not pseudo-random) sources.> We use the SHA-1 cryptographic hash algorithm to mix the entropy > gathered from both sources to provide an extra level of securityThus, we use a mathematical formula to combine these two different 249 bit numbers into a single 498 bit number. Now we have a binary stream of units and naughts, something like this:010101111001011001110110100010001010111101010101011010101010101011...It's much longer than that in reality (498 bits), but you get the idea.The page then says:> To convert random bit stream to random numbers within a required > range without bias, we use a simple and reliable algorithm. For > example, if we need a random number in the range 0-25: >> - we take 5 random bits and convert them to a random number 0-31 > - if this number is greater than 25 we just discard all 5 bits > and repeat the process Finally, we use that method to do the actual shuffle:> To perform an actual shuffle, we use another simple and reliable > algorithm: >> - first we draw a random card from the original deck (1 of 52) > and place it in a new deck - now original deck contains 51 > cards and the new deck contains 1 card >> - then we draw another random card from the original deck (1 of > 51) and place it on top of the new deck - now original deck > contains 50 cards and the new deck contains 2 cards >> - we repeat the process until all cards have moved from the > original deck to the new deck So, how does it work? First, we need a number from 0 to 51 to get one of 52 available cards. To get such a number, we need 6 bits. (I'm assuming you know at least a little bit about binary numbers here since you said it was a "technical" discussion). We take the first six bits of our much larger stream of random bits, and never use them again:010101111001011001110110100010001010111101010101011010101010101011...010101 (use these) 111001011001110110100010001010111101010101011010101010101011...(these are what's left)^^^^^^^^^^If that number is from 52 to 63, we discard it as too large. If it is between 0 and 51, we use it to choose the card. In this case, 010101 is our six bit number, and it is "21", so we choose card 21 as the first card.We continue down the bitstream as needed. We now need 0 to 50 (51 cards left), and the next six bits are 111001, which is 57:------111001011001110110100010001010111101010101011010101010101011...------111001 (use these) 011001110110100010001010111101010101011010101010101011...(these are what's left)^^^^^^^^^^We discard that as too large and continue with the next six bits, 011001, or 25. And so on.Each time the number of cards is reduced, the number of bits we need can drop, too. Here's a table showing how many bits of data we need to choose from N remaining cards:52 = 6 bits needed 35 = 6 bits needed 18 = 5 bits needed51 = 6 bits needed 34 = 6 bits needed 17 = 5 bits needed50 = 6 bits needed 33 = 6 bits needed 16 = 4 bits needed49 = 6 bits needed 32 = 5 bits needed 15 = 4 bits needed48 = 6 bits needed 31 = 5 bits needed 14 = 4 bits needed47 = 6 bits needed 30 = 5 bits needed 13 = 4 bits needed46 = 6 bits needed 29 = 5 bits needed 12 = 4 bits needed45 = 6 bits needed 28 = 5 bits needed 11 = 4 bits needed44 = 6 bits needed 27 = 5 bits needed 10 = 4 bits needed43 = 6 bits needed 26 = 5 bits needed 9 = 4 bits needed42 = 6 bits needed 25 = 5 bits needed 8 = 3 bits needed41 = 6 bits needed 24 = 5 bits needed 7 = 3 bits needed40 = 6 bits needed 23 = 5 bits needed 6 = 3 bits needed39 = 6 bits needed 22 = 5 bits needed 5 = 3 bits needed38 = 6 bits needed 21 = 5 bits needed 4 = 2 bits needed37 = 6 bits needed 20 = 5 bits needed 3 = 2 bits needed36 = 6 bits needed 19 = 5 bits needed 2 = 1 bit needed 1 = 0 bits neededIf you add up all the bits you get (you guessed it) 249 -- the number of bits we take from each of our truly random entropy sources.Since we start with DOUBLE the number of truly random bits needed (249 each from thermal and user inputs), this is enough to ensure that even if we have to discard every other group of bits as "bigger than the maximum number we need", we have enough truly random bits to complete the shuffle.Thus, there isn't really a "seed". That's a concept that applies only to pseudo-random generators. When you refer to a "seed" you mean the first, initial number fed to the pseudo-RNG, from which flows all of the following numbers in a mathematical progression. If you know the seed, and know the mathematical formula, you can get the Nth number in a pseudo-RNG progression by running that formula on the seed, and then the result, and then that result, N times.That doesn't happen at all with our method. At PokerStars, NOTHING is ever pseudo-anything, and nothing is ever "seeded". The next number doesn't depend on the prior one and there's no mathematical formula one can use to figure out the next number. Every time we choose the "next card to go into the randomly shuffled deck", the choice is truly random and not the result of a pseudo-random number generator.Regards,ScottPokerStars Support Team Link to post Share on other sites

Actuary 3 Posted December 20, 2006 Share Posted December 20, 2006 cool Link to post Share on other sites

BudBundy 0 Posted May 15, 2007 Share Posted May 15, 2007 Someone recently mentioned this programme and i checked their website.599$? Are they ****in serious? Link to post Share on other sites

jethrodull 0 Posted May 15, 2007 Share Posted May 15, 2007 just received a response!if the rng in a computer was sufficient, pokerstars wouldn't have to:In this response, they talk about using the predetermined sequence of 0's and 1's...if the 5 bit sequence 01011 = 23, what happens when that sequence comes up two times within the same 52 card "shuffle"? Didn't see the answer to that.J Link to post Share on other sites

qyayqi 11 Posted May 15, 2007 Share Posted May 15, 2007 In this response, they talk about using the predetermined sequence of 0's and 1's...if the 5 bit sequence 01011 = 23, what happens when that sequence comes up two times within the same 52 card "shuffle"? Didn't see the answer to that.Jthey pull the card from the deck, so card 23 isn't the same card each time. it is the 23rd remaining card in the deck. Link to post Share on other sites

jethrodull 0 Posted May 15, 2007 Share Posted May 15, 2007 they pull the card from the deck, so card 23 isn't the same card each time. it is the 23rd remaining card in the deck.and I think that is part of the difference between computer rng and personal shuffling....not that it matters, but the computer has to "know" what each card is in order to not "pick" it again, while a person shuffling "supposedly" doesn't know which card is which...this is one of the reasons why I like b&m better than online. I can see the whole deck and believe that it was "randomly" shuffled...Certainly not any scientific addition to the discussion, though, so I'll just continue lurkingJ Link to post Share on other sites

qyayqi 11 Posted May 15, 2007 Share Posted May 15, 2007 and I think that is part of the difference between computer rng and personal shuffling....not that it matters, but the computer has to "know" what each card is in order to not "pick" it again, while a person shuffling "supposedly" doesn't know which card is which...this is one of the reasons why I like b&m better than online. I can see the whole deck and believe that it was "randomly" shuffled...Certainly not any scientific addition to the discussion, though, so I'll just continue lurkingJ<blank look> a computer "knows" nothing about the cards. it is just churning out random selections.ABCDEFGH012345678 letters, but could be 8 anything. below them are a series of numbers. the rng generates a 3-bit number (0-7). it is 010, or 2. it pulls the corresponding letter C, leavingABDEFGH01234567next number is 111 or 7, discarded as empty slot. next is 0, so pulls the A, then 4, so pulls the G, then 1, pulling D, leaving:BEFHthe program now says a-HA, 4 left! we can now use 2 bits (to represent 0-3)BEFH0123and so on. Link to post Share on other sites

jethrodull 0 Posted May 15, 2007 Share Posted May 15, 2007 I'm really not trying to argue with you or prove that I know anything about this, but wouldn't the computer "know" in the sense that the card values are assigned to some other 3,4 or 5 bit value? If not, than I'm very lost. Which is OK too. J Link to post Share on other sites

qyayqi 11 Posted May 15, 2007 Share Posted May 15, 2007 I'm really not trying to argue with you or prove that I know anything about this, but wouldn't the computer "know" in the sense that the card values are assigned to some other 3,4 or 5 bit value? If not, than I'm very lost. Which is OK too. Jto "know" something about the cards implies an ability to understand their values and possibly do nefarious things. ie, a home-game dealer would know what value cards to put where to stack the deck. the computer is just spitting out selections.a programmer MIGHT easter-egg the program to his benefit, ie if he is on a table and says a certain sequence of words, the program might use a pre-determined deck to his advantage. this is why they have several levels of programmers looking over each others shoulders.but in our case, nothing is known by the RNG. it spits out x bits & a corresponding item is pulled from a stack & placed in a new stack. they probably have the numbers 0-52 stacked, then pull randomly and put these in the new stack. it isn't until we get to the front end-- the actual dealing-- that the program associates card values with the numbers to determine hands & who wins. Link to post Share on other sites

BudBundy 0 Posted May 15, 2007 Share Posted May 15, 2007 I can't believe you continue the discussion after 5 months like nothing happened. Link to post Share on other sites

## Recommended Posts

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account## Sign in

Already have an account? Sign in here.

Sign In Now