package com.freemud.sdk.api.assortment.order.util;

import java.util.Random;

public class ValidationCode {

    public static String getRandomString(int length) {
        String codeSerial = "1234567890abcdefghkmnpqrstwxyABCDEFGHKLMNPQRSTWXY";
        Random random = new Random();
        int n = codeSerial.length();
        StringBuffer code = new StringBuffer();

        for (int i = 0; i < length; ++i) {
            code.append(codeSerial.charAt(random.nextInt(n)));
        }

        return code.toString();
    }

    public static String getRandomNumber(int length) {
        String serial = "0123456789";
        Random random = new Random();
        int n = serial.length();
        StringBuffer code = new StringBuffer();

        for (int i = 0; i < length; ++i) {
            code.append(serial.charAt(random.nextInt(n)));
        }

        return code.toString();
    }

    public static String getRandomUuid() {
        return System.currentTimeMillis() + ""+getRandomString(5);
    }
}
