Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Shuffling
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Algorithms== {{Main|Fisher–Yates shuffle}} If a computer has access to purely random numbers, it is capable of generating a "perfect shuffle", a [[random permutation]] of the cards; beware that this terminology (an algorithm that perfectly randomizes the deck) differs from "a perfectly executed single shuffle", notably a perfectly interleaving [[faro shuffle]]. The [[Fisher–Yates shuffle]], popularized by [[Donald Knuth]], is simple (a few lines of code) and efficient ([[big O notation|O]](''n'') on an ''n''-card deck, assuming constant time for fundamental steps) algorithm for doing this. Shuffling can be seen as the opposite of [[sorting algorithm|sorting]]. A new alternative to Fisher-Yates, which does not use any array memory operations, is the use a Pseudo Random Index Generator (PRIG) function algorithm. There are other, less-desirable algorithms in common use. For example, one can assign a random number to each card, and then sort the cards in order of their random numbers. This will generate a random permutation, unless any of the random numbers generated are the same as any others (i.e. pairs, triplets etc.). This can be eliminated either by adjusting one of the pair's values randomly up or down by a small amount, or reduced to an arbitrarily low probability by choosing a sufficiently wide range of random number choices. If using efficient sorting such as [[mergesort]] or [[heapsort]] this is an [[big O notation|O]](''n'' log ''n'') average and worst-case algorithm. ===Online gambling=== These issues are of considerable commercial importance in [[online gambling]], where the randomness of the shuffling of packs of simulated cards for online card games is crucial. For this reason, many online gambling sites provide descriptions of their shuffling algorithms and the sources of randomness used to drive these algorithms, with some gambling sites also providing auditors' reports of the performance of their systems.{{Citation needed|date=December 2015}}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Shuffling
(section)
Add topic