Sunday, November 23, 2014

Random password both Number and String in ax 2012

// Random password

static void RandomNumberString(Args _args)
{
    //RandomGenerate RandomRange = new RandomGenerate();
    //Random Random = new Random();
    //;
    //info(int2Str(RandomRange.randomInt(20,100)));
    //info(int2Str(Random.nextInt()));

    int i;
    RandomGenerate random = new RandomGenerate();
    str password;
    int passwordLength = 8
    ;
    for (i=1; i<= max(2, passwordLength); i++)
    {
        if (i mod 2)
            password += num2char(random.randomInt(char2num('a', 1), char2num('z', 1)));
        else
            password += num2char(random.randomInt(char2num('0', 1), char2num('9', 1)));
    }
    info(password);
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...