Here you can find the source of randomCharacterVector(int size)
Parameter | Description |
---|---|
size | the length of the random vector |
random | the random number generator used to generate the random vactor |
public static char[] randomCharacterVector(int size)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { private static Random random = new Random(); /**//from www . jav a2 s . co m * Creates a random vector of chars of length <em>size</em>. * @param size the length of the random vector * @param random the random number generator used to generate the random vactor * @return a random vector of char elements */ public static char[] randomCharacterVector(int size) { char[] retVal = new char[size]; for (int i = 0; i < size; i++) { retVal[i] = (char) ('A' + random.nextInt((int) ('Z' - 'A'))); } return retVal; } }