Created
March 11, 2019 14:30
-
-
Save blubbll/db4f9dac14735fecd3e70045509c12ef to your computer and use it in GitHub Desktop.
simple token generator c#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Rextester.Program.Main is the entry point for your code. Don't change it. | |
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Text; | |
using System.Collections; | |
namespace Rextester | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
//Your code goes here | |
Console.WriteLine(token()); | |
} | |
public static string token(int laenge = 10){ | |
List<string> Alphabet = new List<string>() {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", | |
"a", "b", "c", "d", "e", "f", "g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y", "z", "0","1","2","3","4","5","6","7","8","9"}; | |
var random = new Random(); | |
var sb = new StringBuilder(); | |
foreach (var i in Enumerable.Range(0, 10)) | |
{ | |
sb.Append(Alphabet[random.Next(0, Alphabet.Count)]); | |
} | |
return sb.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment