Java Random Number getNumAndWord(int length)

Here you can find the source of getNumAndWord(int length)

Description

get Num And Word

License

Apache License

Declaration

public static String getNumAndWord(int length) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    private static String[] words = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
            "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
            "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "1", "2", "3", "4", "5", "6", "7",
            "8", "9", "0" };

    public static String getNumAndWord(int length) {
        String result = "";
        for (int i = 0; i < length; i++) {
            Random rm = new Random();
            result += words[rm.nextInt(60)];
        }/*from  w w  w.ja v  a2s  .c om*/

        return result;
    }
}

Related

  1. getChance(Number number)
  2. getDocumentNumber()
  3. getFlightNumber()
  4. getNextRandomNumber()
  5. getNum(int length)
  6. getNumber()
  7. getNumber()
  8. getNumber(int _nX0, int _nX1)
  9. getNumber(int length)