how to generate random unique id in c#
public Random a = new Random(); // replace from new Random(DateTime.Now.Ticks.GetHashCode());
// Since similar code is done in default constructor internally
public List<int> randomList = new List<int>();
int MyNumber = 0;
private void NewNumber()
{
MyNumber = a.Next(0, 10);
while(randomList.Contains(MyNumber))
MyNumber = a.Next(0, 10);
}
Also in C#:
- C# get all child classes of a class
- c# static review
- c# skip following code in loop
- C# events
- rotate player unity
- div element position in screen
- c# rsa example
- foreach as parallel c#
- .net core identity get user id
- how to move clipping planes C# in unity
- unity c# get bool from another script
- c# read excel file
- how to pass an optional parameter in c# mvc asp.net
- c# generate random int in range
- using in c#
- C# Unknown column 'FundAllocation' in 'field list
- Move player on planets in unity 2d
- switch case c# contains
- wpf use enum description
- mvc input type file
- unity how to end a game with esc
- unity rotate object relative to camera
- iteration c#
- c# class to byte array