C# Random Shuffle

Hello everyone!

I have a very basic question on C# coding. Imagine we have a list of a, b and c. I created the list as List chars = new List() {a, b, c};

So now I want to do a random.shuffle as we do in Python. How is it possible to create one shuffle function?

Thanks a lot for your helps

private void RunScript(ref object A)
{
  var chars = new List<Char>{'a', 'b', 'c'};
  A = chars.OrderBy(c => rnd.Next()).ToList();
}
// <Custom additional code> 
Random rnd = new Random();
// </Custom additional code> 

Shuffle.gh (2.2 KB)

2 Likes

Thanks a lot.
It worked. :pray: :pray: :pray: