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,266
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,266
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