Java Random Int randomWord(int wordLength)

Here you can find the source of randomWord(int wordLength)

Description

random Word

License

Open Source License

Return

CAPTCHA word

Declaration

private static String randomWord(int wordLength) 

Method Source Code

//package com.java2s;

public class Main {
    private final static String WORD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";

    /**/*w ww  .ja  va  2  s .co  m*/
     * @return CAPTCHA word
     */
    private static String randomWord(int wordLength) {
        StringBuffer word = new StringBuffer();

        for (int i = 0; i < wordLength; i++) {
            int index = Math.abs((int) (Math.random() * WORD.length()));
            char ch = WORD.charAt(index);
            word.append(ch);
        }

        return word.toString();
    }
}

Related

  1. randomStringNumbers(int len)
  2. randomtest(int max)
  3. randomText(int length)
  4. randomWithinRange(int min, int max)
  5. randomWithRange(int min, int max)
  6. randomZeroString(int length)
  7. randowPartition(int[] array, int q, int p)
  8. randProductNumerid(final int c, final int count)
  9. RandSelect(int iTotal)