4 ms·
I think the RNG source is the point here. It's not as impossible as stated, but you have to put some work in to get a good one.
by smallerize 1y ago
I think the RNG source is the point here. It's not as impossible as stated, but you have to put some work in to get a good one.
- awesome_dude 1y agoGo (and probably other languages) has the Fisher-Yates algorithm for shuffling https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
- genghisjahn 1y agoIt’s comments like this that keep me coming back to HN. I’d never heard of this before.
- andrewflnr 1y agoReally? It repeats a point from the article, and in so doing utterly misses the point of the comment it's replying to. Fisher-Yates is at least not broken, but it can only be as good as the underlying RNG.
- awesome_dude 1y agoGo has a cryptographically secure RNG now, I wouldn't be surprised if it's being used for the shuffle. Also, I'm keen to see what shuffle algorithms you know of that aren't susceptible to RNG issues
- kerkeslager 1y ago1. Every remotely competent language has a secure (P)RNG and is using it to Fisher-Yates shuffle. Go is not special in this regard. 2. Nobody in this thread is criticizing Fisher-Yates, because in all likelihood all of us are using Fisher-Yates. We're discussing the failure of the algorithm used in the article. 3. Please take the time to read and understand the posts you respond to before you respond to them.
- awesome_dude 1y agoIn case anyone is following along, the hostility the above poster is demonstrating is because there isn't any shuffling algorithm that isn't susceptible to the RNG issue, and he didn't think about the cryptographically secure RNGs in use today.
- kerkeslager 1y agoMy friend, I am not hostile. I'm merely pointing out that you have not understood a single post you've responded to. Including the one you responded to just now. The following algorithm is not susceptible to RNG issues (in Rust, since I've been playing around with it): fn shuffle(vec: &Vec) -> () { } And I'm sure since you're reading all these posts so carefully you'll totally understand why this is both a joke and a proof that you don't know what you're talking about.
- awesome_dude 1y agoMore snark, thus proving the initial assessment.
- kerkeslager 1y agoA smart move, not responding on topic, since you clearly don't understand the topic. Instead, just accuse me of being snarky! Guilty as charged, I guess, but at least I can read and understand what I'm responding to.
- andrewflnr 1y ago> I wouldn't be surprised if it's being used for the shuffle. That would certainly be a good thing to check before using Go's shuffle for real-money poker games. I wouldn't take it for granted. > Also, I'm keen to see what shuffle algorithms you know of that aren't susceptible to RNG issues There are not and cannot be any such algorithms. That's the entire point of this thread. Fisher-Yates is necessary but not sufficient. You either have sufficient random bits for your shuffle or not.
- namibj 1y agoAs a sort of TL;DR: it's basically like selection sort but instead of selecting the sort-compliant choice among the remaining ones, you ask the RNG and pick a random one.
- duskwuff 1y agoHowever, note that using a random function as the comparator for a sort function does not generally result in an unbiased shuffle.
- vesche 1y agoPython's random.shuffle also uses Fisher-Yates
- awesome_dude 1y agoI wonder how many other languages have it implemented as their shuffle algorithm
- Sanzig 1y agoDo you? Modern CPUs have had built-in TRNGs for years.