CSharp examples for System:Random
Make Random String
using System.Text; using System;/*from w w w . j a va2 s. c om*/ public class Main{ public static string MakeRandomString(string pwdchars, int pwdlen) { StringBuilder builder = new StringBuilder(); Random random = new Random(); for (int i = 0; i < pwdlen; i++) { int num = random.Next(pwdchars.Length); builder.Append(pwdchars[num]); } return builder.ToString(); } }