作者chys49 (丿嘎)
站內NCKU_CSIE93
標題Re: [請益]
時間Sun Oct 5 01:18:32 2008
※ 引述《boypower (321)》之銘言:
: ※ 引述《chys49 (丿嘎)》之銘言:
: : 為了寫出均勻亂數程式
: : 有用到關於蒙地卡羅法的問題
: : 有找到書
: : 但看不明白
: : 不知道有沒有人能幫我看看
: : 地點在成大總圖或附近
: : 拜託了~~m(_ _)m
: google : first grade
: http://203.68.20.65/science/content/1993/00060282/0020.htm
: wikipedia
: http://en.wikipedia.org/wiki/Monte_Carlo_method
: or maybe you can just write down your questions
: then someone would give you a favor more or less.
Questions:
Step1:
Create a routine GetData() to generate a float-point number between
0 and 1 randomly. Since rand() only generate integers from 0 to 32767(i.e.
2^15),to improve the randomness,we use the following scheme:
a□□...□15bits and b□□...□15bits = 30bits (arrays)
The first 15 bits and the latter 15 bits are generated through different
seeds. Then,through a process called normalization,which is to divide the
resulting sequence by 2^30.( Don't use time() )
Step2:
Use the routine GetData() to generate 1000 float-point number data and store
them in a 1-dimensional array named Data{} (maximum capacity 1000).
Please~~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.122.119.75
1F:→ chys49:In C++. 10/05 09:17
2F:推 boypower:這兩題跟蒙地卡羅無關 程式高手救助一下學弟吧! xD 10/05 16:21
3F:→ chys49:求程式高手可能會來不及,但至少有沒有哪位學長有空,可以 10/05 16:35
4F:→ chys49:幫我看我所借的書裡所說的意思? m(學妹)m 10/05 16:38