Randomising a list in .Net

25. December 2009 Howto 0

I’m working on a flash card program for Koine Greek.  I actually wrote it about 3 years ago using VB6 and MS Access.  Not exactly a graceful combination, but it was the tools that I had available.  Recently, my old Greek prof got back in touch with me and asked me to make it available to his students in the coming semester.  Of course, Vista and Windows 7 have since come out, and maintaining the data wasn’t fun, so I decided to port it to .Net.

Part of the program is a “Test Mode” where the words and paradigms are randomized to make sure that the user isn’t just memorizing the order they appear in.  To do that, I used the following code snippet to randomize the list I send to the View.

if (testing)
            {
                List randomList = new List();
                Random r = new Random(DateTime.Now.Millisecond);
                for (int i = 0; i

Leave a Reply

Your email address will not be published. Required fields are marked *