Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# random choice

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]);
      }
   }
}
Comment

c# random choice


static Random rnd = new Random();

Comment

PREVIOUS NEXT
Code Example
Csharp :: c sharp if statements 
Csharp :: c# class where T : enum C# 7.03 
Csharp :: c# generic type converter 
Csharp :: firepower 4125 License update 
Csharp :: Find Center Of Transforms, Points, Multiple Objects 
Csharp :: c# string .contains against empty string returns 
Csharp :: unity int inputfield value 
Csharp :: resize image and add watermark c# 
Csharp :: access form in a folder C# 
Csharp :: asp.net Read raw Body 
Csharp :: convert web app to linux 
Csharp :: soundplayer c# take uri 
Csharp :: itext7 c# memorystream 
Csharp :: c# odd or even 
Csharp :: how to run a console app in another app c# 
Csharp :: reversing linkedlist C# 
Csharp :: join 2 list rows into one row and add totals fields C# 
Csharp :: how to full screen login form using C# MVC 
Csharp :: windows forms webbrowser goback 
Csharp :: how to oppen a site using c# 
Csharp :: aws asp.net tutorial 
Csharp :: hacking 
Csharp :: unity having virtual start 
Csharp :: c# webbrowser control append 
Csharp :: Dynamically checking IList<T C# 
Csharp :: remove tag anchor and inside tag from html raw text c# 
Csharp :: ef null check 
Csharp :: how to get image from resource folder in c# 
Csharp :: check list exist in list c# if matches any 
Csharp :: change object material unity 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =