由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - Anyone knowing how to shuffle a deck of cards in Java?
相关主题
how to shuffle a deck of cards?startup onsite求祝福 + 面经
Randomly shuffle decks of cards再问Amazon的card设计
问道题card shuffle的算法我自己都想不出来
shuffle card 算法求问一道数组shuffle的问题
刚看了下shuffle算法。发现有个问题数组Shuffle 那道题
问一下shuffle card问题这题咋做啊?
Apple 电面报个T家的电面据
java: use vector to shuffle a deck of Card 问题请教几个问题
相关话题的讨论汇总
话题: java话题: anyone话题: int话题: deck话题: shuffle
进入JobHunting版参与讨论
1 (共1页)
G**7
发帖数: 391
1
To keep my status, I have to go back to school. I am not a computer major.
However, one of the classes I am taking is Java. The professor asks us to
write a program to shuffle a deck of cards.
Can anyone tell me the Java code for shuffling a deck of cards? or tell
me where to find such websites or solutions? I have done numerous internet
solutions, but didn't find any codes working.
Would appreciate if anyone can help. You can also send emails to me.
d**e
发帖数: 6098
2
前两天才讨论过
http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle

tell

【在 G**7 的大作中提到】
: To keep my status, I have to go back to school. I am not a computer major.
: However, one of the classes I am taking is Java. The professor asks us to
: write a program to shuffle a deck of cards.
: Can anyone tell me the Java code for shuffling a deck of cards? or tell
: me where to find such websites or solutions? I have done numerous internet
: solutions, but didn't find any codes working.
: Would appreciate if anyone can help. You can also send emails to me.

y***y
发帖数: 224
3
void randint(){
Random r = new Random();
int temp=0;
int index=0;
int[] a = new int[52];
for(int i=0;i a[i]=i;

for(int i=0;i index=r.nextInt(52-i)+i;
temp=a[i];
a[i]=a[index];
a[index]=temp;
}
for(int i=0;i System.out.print(a[i]+" ");
}
1 (共1页)
进入JobHunting版参与讨论
相关主题
请教几个问题刚看了下shuffle算法。发现有个问题
设计card deck问题,还有shuffle function,大家要搞清楚呀问一下shuffle card问题
下午电面MSApple 电面
一道面试题java: use vector to shuffle a deck of Card 问题
how to shuffle a deck of cards?startup onsite求祝福 + 面经
Randomly shuffle decks of cards再问Amazon的card设计
问道题card shuffle的算法我自己都想不出来
shuffle card 算法求问一道数组shuffle的问题
相关话题的讨论汇总
话题: java话题: anyone话题: int话题: deck话题: shuffle