How do I Generate Random Number in C#?

How do I Generate Random Number in C#?

This code snippet shows how to you generate a random number between a range in C#.

The following code snippet shows how to generate a random number between a range in C#, where min and max are minimum and maximum range of the new number.

private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
From:
http://www.c-sharpcorner.com/UploadFile/mahesh/RandomNumber10272005160549PM/RandomNumber.aspx?ArticleID=5b3df921-9d3d-4f55-bf27-5169e970de6d

posted @ 2005-11-29 15:26  jhtchina  阅读(681)  评论(0编辑  收藏  举报