November 12, 2010

程式經驗分享(2)

今天好晚唷! 其實有點想睡了 好吧!

要打就要打廢話XDDD

不要打我~~~(逃)

來~~如果你要寫四個產生的不同亂數 要怎麼寫呢?

哈~~

for(int i=0 ; i< [array count] ; ++i){
   array[i] =(int)(Math.random()*10);
   for(int j = 0; j<i;++j){
       if(array[i]==array[j]){
           i--;
       }
   }

}

這樣子 要產生幾個亂數 就這樣子吧!

陣列方便使用~~ 哈哈!

打這麼簡單 應該會被打吧XDDD 看看囉 上面是JAVA版!

其他語言就換換方式就一樣了!

來睏!

0推薦此文章
Today's Visitors: 0 Total Visitors: 12
Personal Category: Uncategorized Articles Topic: technology / tech info / programming
[Trackback URL]

Post A Comment









Yes No



Please input the magic number:

( Prevent the annoy garbage messages )
( What if you cannot see the numbers? )
Please input the magic number

誰來收藏
Loading ...
unlog_NVPO 0