作者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