
/**
 * This class can be used to generate random letter sequences
 * 
 * @author Dave Reed 
 * @version 9/1/05
 */
public class SequenceGenerator
{
	private String seqAlphabet;

	/**
	 * Constructs a sequence generator using the entire alphabet.
	 */
	public SequenceGenerator()
	{
		seqAlphabet = "abcdefghijklmnopqrstuvwxyz";
	}

	/**
	 * Constructor a sequence generator using a restricted alphabet
	 *   @param alphabet  a string of letters that can be used in the random sequences
	 */
	public SequenceGenerator(String alphabet)
	{
		seqAlphabet = alphabet;
	}
	
	/**
	 * Generates a random letter sequence of the specified length
	 *   @param  seqLength  the number of letters in the random sequence
	 *   @return the random letter sequence
	 */
	public String randomSequence(int seqLength)
	{
		String seq = "";
		for (int i = 0; i < seqLength; i++) {
		    int index = (int)(Math.random()*seqAlphabet.length());
		    seq = seq + seqAlphabet.charAt(index);
		}
		return seq;
	}
}
