看板 Programming 關於我們 聯絡資訊
※ 引述《slayer.bbs@bbs.wretch.cc (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: uranus@it.muds.net 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"的狂狷不馴;屬於年少的輕狂色彩