Return to Snippet

Revision: 4523
at December 29, 2007 01:58 by zvasanth


Initial Code
public static string GetJavascriptRandomValue()
        {
            Random ranDouble = new Random();
            string strd1 = ranDouble.NextDouble().ToString();
            int strd1len = strd1.Length;
            Random ranLong = new Random();
            string strd2 = ranLong.Next().ToString() + ranLong.Next().ToString();
            int intDefLength = 18;
            string strCutFromstrd2 = string.Empty;
            if (strd1len < intDefLength)
            {
                strCutFromstrd2 = strd2.Substring(0, intDefLength - strd1len);
            }
            string strRes = strd1 + strCutFromstrd2;
            return strRes;
        }

Initial URL
ideabubbling.com

Initial Description
drunkenprogrammer

Initial Title
Get Javascript Random Value

Initial Tags
javascript

Initial Language
C#