Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# random enum

public T RandomEnum<T>(T obj)
{
	List<T> enums = Enum.GetValues(typeof(T)).Cast<T>().ToList();
	System.Random random = new System.Random();

	return enums[random.Next(0, enums.Count)];
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c sharp list of strings 
Csharp :: how to set the fps in monogame 
Csharp :: how to get delta time in monogame 
Csharp :: how to download file from url using c# 
Csharp :: c# datetime dd/mm/yyy hh:mm:ss 
Csharp :: c# get free space on drive 
Csharp :: c# list files in directory 
Csharp :: stop audio unity 
Csharp :: set player position unity 
Csharp :: make an enemy go towards player unity 
Csharp :: C# string format sepperate every thousand 
Csharp :: 3(x-4)-2(3x+4)=4(3-x)+5x+4 
Csharp :: C# previous method 
Csharp :: unity 2d detect click on sprite 
Csharp :: unity save list to json 
Csharp :: c# count number of occurrences in string 
Csharp :: instantiate an object at a certain position unity 
Csharp :: unity remove gameobject 
Csharp :: #region in c# 
Csharp :: how to make rb.addforce 2d 
Csharp :: c# create array of number from number 
Csharp :: how to append a new line in a txt file c# 
Csharp :: how to start a coroutine in c# 
Csharp :: change scene unity 
Csharp :: unity change tag of go 
Csharp :: c# winforms tooltip 
Csharp :: there are any objects when open project unity 
Csharp :: c# multiline string with variables 
Csharp :: c# thread wait 
Csharp :: c# file exist 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =