Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# pick a random item from array

string[] names = new string[] { "name1", "name2", "name3" };
Random rnd = new Random();
int index = rnd.Next(names.Length);
Console.WriteLine($"Name: {names[index]}");
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pick #random #item #array
ADD COMMENT
Topic
Name
7+4 =