• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

License key generator

Pavle

Active member
Joined
Oct 4, 2016
Messages
43
Programming Experience
1-3
I made program in C# that generates random license keys with 24,25,26,27,28,29,30 characters lenght.How to make 100 random keys with 24,25,26,27,28,29,30 characters lenght?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
2,202
Location
Sydney, Australia
Programming Experience
10+
Are you asking how to generate 100 keys with a random length? 100 keys of each length? Something else?
 

Pavle

Active member
Joined
Oct 4, 2016
Messages
43
Programming Experience
1-3
I want 100 random keys with of each lenght?
 
Last edited:

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
2,202
Location
Sydney, Australia
Programming Experience
10+
For example:
var keysByLength = new Dictionary<int, string[]>();

for (var length = 24; length <= 30; length++)
{
    keyByLength.Add(length, Enumerable.Range(1, 100).Select(n => GetKeyOfLength(length)).ToArray());
}
 
Top Bottom