Random Number by size - CSharp System

CSharp examples for System:Random

Description

Random Number by size

Demo Code


using System.IO;/*from  w w  w.jav a 2  s .c o m*/
using System.Collections;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

public class Main{
        public static string RandomNumber(int size)
        {
            Random _rng = new Random();

            char[] buffer = new char[size];

            for (int i = 0; i < size; i++)
            {
                buffer[i] = _Numbers[_rng.Next(_Numbers.Length)];
            }
            return new string(buffer);
        }
}

Related Tutorials