Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get list item in random order

private static Random rng = new Random();  

public static void Shuffle<T>(this IList<T> list)  
{  
    int n = list.Count;  
    while (n > 1) {  
        n--;  
        int k = rng.Next(n + 1);  
        T value = list[k];  
        list[k] = list[n];  
        list[n] = value;  
    }  
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get the first 4 characters in the list 
Csharp :: where in used in linq c# 
Csharp :: c# right function 
Csharp :: how to validate if date is a weekday or weekend c# 
Csharp :: if checkbox checked in c# 
Csharp :: change size of a unity object 
Csharp :: C# setting property values through reflection with attributes 
Csharp :: the .net core sdk cannot be located 
Csharp :: c# close program 
Csharp :: how to add rigidbody in unity 
Csharp :: C# clear form 
Csharp :: check if value in list c# 
Csharp :: maclaurin series 
Csharp :: And this is how can you deserialize your XML file in your C# code: 
Csharp :: get all classes that extend a class c# 
Csharp :: c# wpf timer 
Csharp :: combobox selected name c# 
Csharp :: mongodb c# batch find 
Csharp :: .net 6 autofac 
Csharp :: get number of days between two dates c# 
Csharp :: c# Dictionary contains key case insensitive 
Csharp :: c# best way to loop and remove 
Csharp :: sequelize top 
Csharp :: enable cors asp.net mvc 
Csharp :: unity rigidbody2d disable 
Csharp :: c# object is in object list 
Csharp :: get file name from stream c# 
Csharp :: How can I display image from database in asp.net mvc. I created image table and image path as varchar 
Csharp :: audio unity 
Csharp :: check if two timespans intersect c# 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =