Wow, this must be the worst article ever on Codeproject: http://www.codeproject.com/useritems/randm_no.asp
Since it will be removed as soon as the admins of codeproject notice it I will post the content here:
generaerandom no
By sabuj_sen.
generate random no in wo ways
Introduction
it is a usful code for generating random no...the random no generation process in two ways..
one is using guid methd..another is random method.
this code is very simsimple.it veryeasy to under stand and implement..
the code us C#.net languages and using visual studio 2005. their is two eparate file .two ile contain two different processes.
it isvery simple way to gnerate random no.
you can easily use code in your projects...
just unzip the file and run in the .net 2005 envioment using fremwork 2.0.
Using the code
the code us C#.net languages and using visual studio 2005. their is two eparate file .two ile contain two different processes.
it isvery simple way to gnerate random no.
just unzip the file and run in the .net 2005 envioment.
Blocks of code should be set as style "Formatted" like this:
//
// private Random random = new Random();
private void GenerateRandomCode()
{
string s = "";
for (int i = 0; i < 6; i++)
s = String.Concat(s, this.random.Next(10).ToString());
//return s;
label1.Text = s;
public void random()
{
String guidResult = System.Guid.NewGuid().ToString();
guidResult = guidResult.Replace("-", String.Empty);
string str0 = guidResult.Substring(0,6);
label1.Text=str0;
}
}//
Remember to set the Language of your code snippet using the Language dropdown.
Points of Interest
this code is very simsimple.it veryeasy to under stand and implement..
the code us C#.net languages and using visual studio 2005. their is two eparate file .two ile contain two different processes.
it isvery simple way to gnerate random no.
you can easily use code in your projects...
just unzip the file and run in the .net 2005 envioment using fremwork 2.0.
History
Keep a running update of any changes or improvements you've made here.
About sabuj_sen
.net programer.