The Fisher–Yates shuffle is an algorithm for generating a random permutation of a finite sequence. Use this tag for questions about this algorithm and it's implementation.
Questions tagged [fisher-yates-shuffle]
34 questions
-2
votes
1 answer
I need to convert list in java into java array with while loop
I get the question about choosing a random word from user input using Knuth's shuffling algorithm, but the problem is I have the constraint of using some specific libraries.
(here is the link for more details - my part is to form the random word…

DTJ
- 5
- 2
-2
votes
1 answer
What is the principle of randomly selecting positions to swap in the shuffle function
Fisher–Yates shuffle means that we take the last number from the selected segment every time and swap it with the previously randomly selected number, iterate continuously, and finally achieve random shuffling.The code for the official Shuffle in…

Rxma
- 312
- 2
- 9
-3
votes
0 answers
Get 'n' random numbers within range
I am trying to set up a function that, for example, will return 10 numbers between 1 and 5 or 6 and 10 (1/6 and 5/10 included with duplicates) But I keep getting numbers between 0 and 4.
function potato(min, max, times) {
const randoms = []
…

TheCarbunkle
- 1
- 3
-4
votes
1 answer
Can someone help explain the Fisher Yates Array Shuffle
So I am trying to get an understanding for array shuffling.
I came across this article:
https://bost.ocks.org/mike/shuffle/
But I am confused.
function shuffle(array) {
var m = array.length, t, i;
// While there remain elements to shuffle…
…

ZenithF0RTE
- 363
- 4
- 11