Create Random No by date - CSharp System

CSharp examples for System:Random

Description

Create Random No by date

Demo Code


using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
using System;/*  w ww  . j a  v a 2s . co  m*/

public class Main{

        public static string CreateNo()
        {
            Random random = new Random();
            string strRandom = random.Next(1000, 10000).ToString(); 
            string code = DateTime.Now.ToString("yyyyMMddHHmmss") + strRandom;
            return code;
        }
}

Related Tutorials