How to randomize datatable row order using Fisher-Yates (Knutes) shuffle

studio

#1

I’m trying to implement a randomization to the row order in a datatable and am not quite sure how to implement it. I experimented simply using the System.Random class + OrderBy but found I was getting duplicates fairly consistently. I then tried using an if statement to check for duplicates prior to giving the row a random number, but that significantly slows down the program.

Ideally, I’d like to use the Fisher-Yates Shuffle to randomize the datatable rows as it would be truly random with no duplicates, but I’m not quite sure how to implement it in uipath.