Tabletop Simulator

Tabletop Simulator

Hand Shuffler
13 Comments
KnightHawk 10 Jun, 2020 @ 12:44pm 
Sorry for the necro of this thread, btw. I am guessing you will be unable to assist?
KnightHawk 7 Jun, 2020 @ 6:40pm 
I know this is quite old and I'm not sure if this will get a response, but is it possible to bind this to all colors? The mod I am working on, requires that everyone's hand be flipped at once. Still fairly new to coding.

Thanks in advance.
Geek Sheikh 22 Aug, 2017 @ 4:37am 
Thank you for all of your help.

Request sent.
MrStump  [author] 21 Aug, 2017 @ 11:28am 
Feel free. If you need to tweek it to suit your purposes, that is also fine. If you want to tweek it and can't, feel free to add me on steam and I'll help you set it up.
Geek Sheikh 21 Aug, 2017 @ 8:45am 
Hi Mr. Stump.

This tool is perfect for a game I am developing on TTS.

With your permission, I would like to feature it in the game and credit you accordingly.

Any other advice or information is much appreciated.

Many thanks.
waka 20 Aug, 2017 @ 5:17am 
nice
Eliont 30 Sep, 2016 @ 11:57pm 
thanks
MrStump  [author] 28 Aug, 2016 @ 8:18am 
I actually was running it 2x the number of entries in the table. And I was doing that for both positions and for cards, so I ended up with a lot of redundant layers that probably would have masked any bias. Even so, no harm in changing it.
spheniscine 28 Aug, 2016 @ 4:36am 
I don't know how much the bias is apparent when shuffling only three cards; that Wiki article gives an example with 7 members. Additionally, you say you run the randomization twice. That might have smoothed out the bias somewhat (but not completely), making it harder to spot via experimentation.
MrStump  [author] 27 Aug, 2016 @ 9:00am 
Well, I'm still not seeing the bias, but I don't deny it could be there, so I switched methods to be safe. Its a neater implimentation anyway
MrStump  [author] 27 Aug, 2016 @ 8:09am 
After comparing our methods, I decided to just brute-force test the randomization using 3 cards, named ABC (which never change position). I just threw them into the randomization engine using function update() and tracked the results. First, I used my method [screencast.com]. Then your method [screencast.com]. Very similar results, and when I repeated the test up to about 2000 each, I didn't see any repeating patterns emerging in the distribution for either method.

Are you sure my method suffers from any of those biases from the wiki article? Your method IS lighter weight (I use 2 random numbers while you only use one), but they seem to be providing similar results.
spheniscine 27 Aug, 2016 @ 4:13am 
Oops, Steam messed up my code. See http://pastebin.com/XPBmrEnr
spheniscine 27 Aug, 2016 @ 4:11am 
The shuffleTable() function in the code is subtly wrong; see second paragraph of https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Implementation_errors

It should be something like:

function shuffleTable(table)
for i = #table, 2, -1 do
local n = math.random(i)
table , table[n] = table[n], table
end
return table
end