How To Generate Random Number quickly

Posted by Alok under ASP.NET on 4/10/2013 | Points: 10 | Views : 3213 | Status : [Member] | Replies : 6
I want to generate 1 crore random Number quickly..
How To acheive it..

Thanks & Regards,
Alokssm



Responses

Posted by: Satyapriyanayak on: 4/10/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://www.c-sharpcorner.com/UploadFile/mahesh/RandomNumber11232005010428AM/RandomNumber.aspx
http://www.codeproject.com/Articles/164087/Random-Number-Generation
http://www.dotnetperls.com/random

If this post helps you mark it as answer
Thanks

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 4/10/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try this Code


for (int i = 0; i <= 5; i++)
{
Guid ff = Guid.NewGuid();
Response.Write("<br>"+ff.ToString().Substring(1, 5));
}


Mark as Answer if its helpful to you

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Alok on: 4/10/2013 [Member] Starter | Points: 25

Up
0
Down
your code is not feasible if you try to to generate 10 crore of random number quickly..
I think we have to use Mulithreding..but How?
Please Reply Soon..

Thanks & Regards,
Alokssm

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Alok on: 4/12/2013 [Member] Starter | Points: 25

Up
0
Down
i set uniqueidentifier column in table,

NO need to use Multithreading Here..
..but however 10 crore unique number generation will take time..
to create fast we should make some modification in Table..like Table Partition..

Thanks & Regards,
Alokssm

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 4/13/2013 [Member] Starter | Points: 25

Up
0
Down
string RandomNumber=RandamNumberGenerator();



public string RandamNumberGenerator()
{

var chars = "0123456789";
var random = new Random();

var result = new string(
Enumerable.Repeat(chars, 10)
.Select(s => s[random.Next(s.Length)])
.ToArray());
return result;
}

sourabh

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 4/15/2013 [Member] Starter | Points: 25

Up
0
Down
You can use Membership.GeneratePassword();

Syntax:
public static string GeneratePassword(
int length,
int numberOfNonAlphanumericCharacters
)

Example:

// Generate a new 12-character password with 1 non-alphanumeric character.
string password = Membership.GeneratePassword(12, 1);


http://hashtagakash.wordpress.com/

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response