Most efficient way to randomly “sort” (Shuffle) a list of integers in C#

前端 未结 12 1383
长发绾君心
长发绾君心 2020-11-22 12:25

I need to randomly \'sort\' a list of integers (0-1999) in the most efficient way possible. Any ideas?

Currently, I am doing something like this:

bo         


        
12条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 13:03

    itemList.OrderBy(x=>Guid.NewGuid()).Take(amount).ToList()
    

提交回复
热议问题