Skip to content

Instantly share code, notes, and snippets.

@sachintha81
Created June 7, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sachintha81/daef9377e6fda8d325d34a922b46d91a to your computer and use it in GitHub Desktop.
Save sachintha81/daef9377e6fda8d325d34a922b46d91a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StackOverflow
{
class Program
{
static void Main(string[] args)
{
var list = new List<int>() { 1, 2, 3, 4, 5, 6 };
PrintList(list);
var rnd = new Random();
var shuffled = list.OrderBy(x => rnd.Next()).ToList();
Console.WriteLine();
PrintList(shuffled);
Console.ReadLine();
}
static void PrintList(List<int> list)
{
foreach (var item in list)
Console.Write("{0} ", item);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment