9 若某程式語言之隨機亂數函式 rand()可回傳介於 0 至 1(包含 0 但不包含 1)的隨機實數,另函式 int(x)可回
傳實數參數 x 的整數值部分,今若要產生介於 1 至 6(包含 1 與 6)的隨機整數,可用以下何者算式?
(A)int(rand())*6
(B)int(6)+ rand()
(C)rand()*6+int(rand())
(D)int(rand()*6)+1
答案:登入後查看
統計: A(14), B(14), C(12), D(153), E(0) #668244
統計: A(14), B(14), C(12), D(153), E(0) #668244