Java Random Int randomKey(int sLen)

Here you can find the source of randomKey(int sLen)

Description

random Key

License

Open Source License

Declaration

public static String randomKey(int sLen) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * -----------------------------------------------------------------------------
 * <br>//from  ww w . j a  v a 2 s .co  m
 * <p><b>Copyright (c) 2015 Quix Creation Pte. Ltd. All Rights Reserved.</b> 
 * <br>
 * <br>
 * This SOURCE CODE FILE, which has been provided by Quix as part
 * of a Quix Creations product for use ONLY by licensed users of the product,
 * includes CONFIDENTIAL and PROPRIETARY information of Quix Creations.
 * <br>
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
 * THE PRODUCT.<br>
 * <br>
 * </p>
 * -----------------------------------------------------------------------------
 * <br>
 * <br>
 * Modification History:
 * Date              Developer          Change Description
 * 07-May-2015       Jay          
 * 
 ****************************************** *********************************** */

public class Main {

    public static String randomKey(int sLen) {
        String base;
        String temp;
        int i;
        int p;

        base = "1234567890abcdefghijklmnopqrstuvwxyz";
        temp = "";
        for (i = 0; i < sLen; i++) {
            p = (int) (Math.random() * 37);
            if (p > 35)
                p = 35;
            temp += base.substring(p, p + 1);
        }
        return temp;
    }
}

Related

  1. randomIntFromRange(int min, int max)
  2. randomIntInInterval(int lower, int upper)
  3. randomIntInRange(int lowerBound, int upperBound)
  4. randomIntRange(int low, int high)
  5. randomIntWithDigits(int digits)
  6. randomMatrix(int x, int y)
  7. randomModuleName(int count)
  8. randomNum(int n)
  9. randomNum(int number)