I have a DataGridView with thousands of records which I programmatically added them. There is no datasource involved in this case. Now I want to shuffle the records each time I click a button. How can that be achieved?
I would not recommend OrderBy(x => Guid.NewGuid()). Depending on the system, your Guid could be sequential. GUIDs are meant to be unique, not random. To shuffle a collection, you can call sort and passes in a Comparator that returns result at random (e.g. Random(-1, 1)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With