package edu.gatech.oad.antlab.person;

/**
 *  A simple class for person 2
 *  returns their name and a
 *  modified string 
 *
 * @author Bob
 * @version 1.1
 */
public class Person2 {
    /** Holds the persons real name */
    private String name;
	 	/**
	 * The constructor, takes in the persons
	 * name
	 * @param pname the person's real name
	 */
	 public Person2(String pname) {
	   name = pname;
	 }
	/**
	 * This method should take the string
	 * input and return its characters in
	 * random order.
	 * given "gtg123b" it should return
	 * something like "g3tb1g2".
	 *
	 * @param input the string to be modified
	 * @return the modified string
	 */
	private String calc(String input) {
		char[] inputString = input.toCharArray();
		for(int i = 0; i < inputString.length - 1; i++) {
			int randomIndex = (int)Math.floor(Math.random() * inputString.length);
			char temp = inputString[i];
			inputString[i] = inputString[randomIndex];
			inputString[randomIndex] = inputString[temp];
		}
		return new String(inputString);
	}
	/**
	 * Return a string rep of this object
	 * that varies with an input string
	 *
	 * @param input the varying string
	 * @return the string representing the 
	 *         object
	 */
	public String toString(String input) {
	  return name + calc(input);
	}
}

@@ -31,16 +31,42 @@
 person;%0D
+%0Aimport java.util.Random;%0D
 %0A%0D%0A/**%0D%0A
@@ -758,22 +758,21 @@
 char
-%5B%5D input
+ char
 String
+%5B%5D
  = i
@@ -797,16 +797,17 @@
 ;%0D%0A%09%09for
+ 
 (int i =
@@ -814,21 +814,20 @@
  0; i %3C 
-input
+char
 String.l
@@ -835,12 +835,8 @@
 ngth
- - 1
 ; i+
@@ -866,45 +866,27 @@
 x = 
-(int)Math.floor(Math.random() * input
+random.nextInt(char
 Stri
@@ -913,21 +913,20 @@
  temp = 
-input
+char
 String%5Bi
@@ -928,29 +928,28 @@
 ing%5Bi%5D;%0D%0A%09%09%09
-input
+char
 String%5Bi%5D = 
@@ -944,29 +944,28 @@
 String%5Bi%5D = 
-input
+char
 String%5Brando
@@ -977,21 +977,20 @@
 x%5D;%0D%0A%09%09%09
-input
+char
 String%5Br
@@ -1007,25 +1007,12 @@
 %5D = 
-inputString%5B
 temp
-%5D
 ;%0D%0A%09
@@ -1035,21 +1035,20 @@
  String(
-input
+char
 String);

update calc method