Created
June 7, 2018 19:28
-
-
Save sachintha81/daef9377e6fda8d325d34a922b46d91a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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