Here you can find the source of randomString(int len)
public static String randomString(int len)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static final char[] letters = { 'A', 'T', 'G', 'C' }; public static Random rand = new Random(); public static String randomString(int len) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) { sb.append(randomLetter());// w w w .ja v a 2s. c om } return sb.toString(); } public static char randomLetter() { return letters[rand.nextInt(letters.length)]; } }