Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
IotaSeedGenerator
//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.Linq; using System.Security.Cryptography; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { var validCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ9".ToList(); var len = 81; var cnt = 10; using (var rng = new RNGCryptoServiceProvider()) { while (--cnt > 0) { var sb = new StringBuilder(len); while (sb.Length < len) { var nextUint = rng.GetNextUint(); var nextIndex = (int) (nextUint % validCharacters.Count); var nextCharacter = validCharacters[nextIndex]; if (validCharacters.Contains(nextCharacter)) sb.Append(nextCharacter); } Console.WriteLine(sb); } } } } public static class RngExt { public static uint GetNextUint(this RandomNumberGenerator r) { var buffer = new byte[sizeof(uint)]; r.GetBytes(buffer); return BitConverter.ToUInt32(buffer, 0); } } }
run
|
edit
|
history
|
help
0
rathit
problem 2
Test
Does string contain only digits
a5
C# Calculator Simple
Swap 2
error2
remove special char
75