Question by 
               gamedragonify · Jan 07, 2020 at 11:46 PM · 
                c#list  
              
 
              Problem with Fisher Yates Shuffle in C#
Hey, I'm making a deck building game and want to be able to shuffle a deck of cards. I tried doing it using a version of the Fisher Yates Shuffle, but It's not working. I'm not given any errors, the game just doesn't do anything when I try to use the function.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class Deck : MonoBehaviour
 {
     public List<Card> AbilityDeck;
 
 
     public void ShuffleDeck()
     {
         Shuffle(AbilityDeck);
     }
 
     public void Shuffle<T>(IList<T> list)
     {
         System.Random random = new System.Random();
         int n = list.Count;
         while (n < 1)
         {
             int k = random.Next(n);
             n--;
             T temp = list[k];
             list[k] = list[n];
             list[n] = temp;
         }
     }
 }
 
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How Do I Create a List of Two Strings? C# 1 Answer
Updating a List from a Custom Inspector 0 Answers
Firebase List Users 1 Answer
list.contains problem 1 Answer
[Quiz Game] How to prevent Question asked twice. HELP 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                