Skip to content

Instantly share code, notes, and snippets.

@RamonBeast
RamonBeast / FisherYatesShuffle.cs
Created March 20, 2021 16:41
C# class to shuffle an array using Fisher-Yates algorithm in order to guarantee a non-repeating list of random integers within a given range
using System;
/*
C# implementation of Fisher-Yates shuffling with automatic reshuffling.
This class can be used to generate a series of numbers from 0 to ``numElements`` that is guaranteed
not to repeat. The array is automatically reshuffled when all elements have been picked.
*/
public class FisherYatesShuffling