Card shuffles: Difference between revisions

Content added Content deleted
m (→‎{{header|Raku}}: Undo bizarre single space indent that somebody found necessary to do. Remove obsolete use v6.0;)
Line 120: Line 120:


while (lp < cutPoint && rp < size) {
while (lp < cutPoint && rp < size) {
/* Allow for an imperfect riffling so that more than one card can come from the same side in a row
/* Allow for an imperfect riffling so that more than one card
biased towards the side with more cards. Remove the IF statement for perfect riffling. */
can come from the same side in a row biased towards the side
with more cards. Remove the IF statement for perfect riffling.
*/
bound = (cutPoint - lp) * 50 / (size - rp);
bound = (cutPoint - lp) * 50 / (size - rp);
if (random(0, 50) >= bound) {
if (random(0, 50) >= bound) {
Line 162: Line 164:
}
}


/* add them to the cards in the other hand, sometimes to the fron sometimes to the back */
/* add them to the cards in the other hand,
sometimes to the front sometimes to the back */
if (random(0, 10) >= 1) {
if (random(0, 10) >= 1) {
/* front most of the time */
/* front most of the time */
Line 248: Line 251:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
[20, 17, 18, 19, 14, 15, 16, 10, 11, 12, 13, 9, 8, 7, 5, 6, 1, 2, 3, 4]</pre>
[20, 17, 18, 19, 14, 15, 16, 10, 11, 12, 13, 9, 8, 7, 5, 6, 1, 2, 3, 4]</pre>

=={{header|C sharp|C#}}==
=={{header|C sharp|C#}}==
{{trans|Java}}
{{trans|Java}}