using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
string command = "5,20,33,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92";
if (command.Contains(","))
List<string> list38 = text88.TrimStart(new char[]{','}).Split(new char[]{','}).ToList<string>();
foreach (string value4 in string.Join(" ", list38.ToArray()).Split(new char[]{' '}))
newbuilder = newbuilder + value4;
newbuilder = newbuilder + "|" + value4;
totalstrings = totalstrings + 1;
newbuilder = newbuilder + "]";
newbuilder = "[" + newbuilder;
var s = new RandomString(newbuilder);
for (int i = 0; i < 1; i++)
Console.WriteLine("Random String: " + s);
Console.WriteLine("ERROR: Invalid Block ID!");
public class RandomString {
private Random _rnd = new Random();
private static Regex _rex = new Regex(@"\[ ( \|? (?<option>[^]|]+) )+ \]", System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | System.Text.RegularExpressions.RegexOptions.ExplicitCapture);
public RandomString(string template) {
public override string ToString() {
return _rex.Replace(_template, GetRandomOption);
public string GetRandomOption(Match m) {
var options = m.Groups["option"].Captures;
int choice = _rnd.Next(0, options.Count);
return options[choice].Value;