UNB/ CS/ David Bremner/ teaching/ java/ Shuffle.java
public class Shuffle{
    public static void main(String[] args){
        String cards="A23456789TJQK";
        cards=shuffle(cards);
        System.out.println(cards);
        cards=shuffle(cards);
        System.out.println(cards);
    }

    static String shuffle(String cards){
        if (cards.length()<=1)
            return cards;

        int split=cards.length()/2;

        String deck1=shuffle(cards.substring(0,split));
        String deck2=shuffle(cards.substring(split));

        if (Math.random() > 0.5) 
            return deck1 + deck2;
        else 
            return deck2 + deck1;
    }
}