這是一個面試問題。請提供一些提示:java:卡洗牌,
使用vector實現一個方法,洗牌一副牌。
public class Card {
private int value;
Card(int v) {
value = v;
}
public void print(){
System.out.print(value+";");
}
}
public class DeckShuffle {
private final int num;
Vector<Card> deck = new Vector<Card>();
// implement this shuffle function. DO NOT USE Collections.shuffle() !!
public void shuffle(){
// your code goes here!
}
}
http://www.codinghorror.com/blog/2007/12/the-danger-of-naivete.html – Flexo 2011-10-02 17:34:39