m*a
2 楼
朋友带4岁孩子来访学半年,怕生病,想卖便宜点的保险,求推荐。学校推荐的太贵。
l*i
11 楼
generate r and theta, then use (r,theta), polar coordinate?
M*5
13 楼
你最后的结果是要二维的还是一维的?如果是一维的话只能是这样的吧?要是结果是二
维的也还蛮好改的。。。
#include "math.h"
struct Coordinate{
int x;
int y;
};
int sign(){
double n = rand();
if( n<=0.5 )
return -1;
else
return 1;
}
Coordinate UniDistCircle(){
Coordinate co;
while(true){
double m = rand();
double n = rand();
double t = m*m + n*n;
if( t<=1.0){
co.x = sign()*m;
co.y = sign()*n;
return co;
}
}
}
【在 j*****y 的大作中提到】
: 多谢 。
: 不过这个只能产生 1/4 个圆内的吧, 负数坐标出不来阿.
维的也还蛮好改的。。。
#include "math.h"
struct Coordinate{
int x;
int y;
};
int sign(){
double n = rand();
if( n<=0.5 )
return -1;
else
return 1;
}
Coordinate UniDistCircle(){
Coordinate co;
while(true){
double m = rand();
double n = rand();
double t = m*m + n*n;
if( t<=1.0){
co.x = sign()*m;
co.y = sign()*n;
return co;
}
}
}
【在 j*****y 的大作中提到】
: 多谢 。
: 不过这个只能产生 1/4 个圆内的吧, 负数坐标出不来阿.
w*e
14 楼
赌一下不会有需要住院的话,看几次医生自己付钱比买保险便宜,当然,这个几次不好
说。
说。
b*0
16 楼
可以买旅行保险吧。我在华人上看到说“万国游踪”理赔还挺痛快的,价格也不贵。
f*n
23 楼
No. You can't just use uniform distribution for r, because that way it will
be too concentrated in the middle and too spread out at the edge.
r needs to be weighted to the higher numbers. Specifically, the probability
distribution of r needs to be P(r) = 2r. So that at r = 1, it is twice as
likely as at r = 0.5. This is because dx dy = r dr dθ in polar coordinates.
To do that you can use inverse transform sampling http://en.wikipedia.org/
wiki/Inverse_transform_sampling). The cumulative distribution of r is r^2.
Therefore, to generate r with the correct distribution, you need to take
sqrt(rand()).
【在 l***i 的大作中提到】
: generate r and theta, then use (r,theta), polar coordinate?
be too concentrated in the middle and too spread out at the edge.
r needs to be weighted to the higher numbers. Specifically, the probability
distribution of r needs to be P(r) = 2r. So that at r = 1, it is twice as
likely as at r = 0.5. This is because dx dy = r dr dθ in polar coordinates.
To do that you can use inverse transform sampling http://en.wikipedia.org/
wiki/Inverse_transform_sampling). The cumulative distribution of r is r^2.
Therefore, to generate r with the correct distribution, you need to take
sqrt(rand()).
【在 l***i 的大作中提到】
: generate r and theta, then use (r,theta), polar coordinate?
s*1
24 楼
k*a
25 楼
generate random number r1, X=2*(r1-0.5)
generate random number r2, Y=2*(r2-0.5)
if X^2+Y^2<1 then return (X, Y)
generate random number r2, Y=2*(r2-0.5)
if X^2+Y^2<1 then return (X, Y)
m*a
26 楼
thank you.
got one from
https://www.ehealthinsurance.com/
【在 s********1 的大作中提到】
: https://www.isoa.org/?gclid=CI3c1qPx8rwCFTHxOgodEXcA-g
: 看看这上面的有没有
got one from
https://www.ehealthinsurance.com/
【在 s********1 的大作中提到】
: https://www.isoa.org/?gclid=CI3c1qPx8rwCFTHxOgodEXcA-g
: 看看这上面的有没有
相关阅读
虎毒不食子,但人可以食子如何进行孩子的智力开发 (转载)孕妈注意事项:孕期让胎儿开心的方法(转载)要骂人了你家的孩子爱说中文吗?这样的孩子算是非常delay么?隔壁总是家庭暴力会不会影响我的孩子木兰成长记之三 - 不得不承认Re: 郎平也太低调了吧 (转载)where to buy pokeman squirtle quickley?英国园艺工跑决赛前发现只带了一只钉鞋? (转载)两个工作选哪个?有没有人特别反感小男孩露小JJ的?对孩子一定要宽容一岁半孩子的幼儿园选择问题,请爱心爸妈建议!龙永图:从我送外孙女去美国谈谈中国的教育 (转载)孩子的手机这些看似是帮助孩子学习的,其实是危害孩子健康的。(转载)小孩子旅行证北京转机入关风险可能性? (转载)9月出生的女娃,赶不上公立学校开学,是等一年还是上私立?