看板Programming
标 题Re: [问题] 老师出的java作叶
发信站政大狂狷年少 (Sun Dec 10 09:21:21 2006)
转信站ptt!ctu-reader!ctu-peer!news.nctu!news.cis.nctu!news.cs.nthu!WHSHS
※ 引述《[email protected] (foolish)》之铭言:
> 其实呢
> 有写java的人大概会用
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html
> #shuffle(java.util.List)
> 搞定 :)
嗯,照原 po 说的限定 1 - 52 之间,
的确先产生出 1 - 52 然後再 shuffle 就搞定了,
C++ 的 STL 也有喔:
http://www.sgi.com/tech/stl/random_shuffle.html
不过要是题目改成任 52 个乱数的话,
这招可能就行不通了。
--
Name: Tseng, Ling-hua E-mail Address:
[email protected]
School: National Tsing Hua University Department: Computer Science
Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design
Researching: Software pipelining for VLIW architectures
Homepage:
https://it.muds.net/~uranus
--
╔═══╗ ┼────────────────────────╮
║狂狷 ║ │
* Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮
║ 年少║ ┼╮
< IP:140.119.164.252 > ╰─╮
╚╦═╦╝ ╰
* From:61-230-220-9.dynamic.hinet.net
─╨─╨─ KGBBS ─ ◎ 遨翔"BBS"的狂狷不驯;属於年少的轻狂色彩 ◎