Answers for "get 10 random elements from list c# only once"

C#
1

get random from list c#

using System;
using System.Collections.Generic;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         var random = new Random();
         var list = new List<string>{ "one","two","three","four"};
         int index = random.Next(list.Count);
         Console.WriteLine(list[index]);
      }
   }
}
Posted by: Guest on November-14-2020
0

c# get random index from list

// set a list in C#.
var myList = new List<int>{ 1, 2, 3, 4 };
// get the count of the elements and display randomly.
int index = random.Next(myList.Count);
Console.WriteLine(myList[index]);
Posted by: Guest on July-01-2021

Code answers related to "get 10 random elements from list c# only once"

C# Answers by Framework

Browse Popular Code Answers by Language