oo = 1;
while(oo){
thisdec = drand48()*mask; // Choose a declination inside the mask
theta = drand48(); //Choose a random value for sin(thisdec)
/*If theta is "below the sin(thisdec) curve",
keep thisdec, otherwise repeat above process. */
if(theta < sin(thisdec){
Rb[nn].pos[i] = thisdec;
oo = 0;
}
}
This uses a rejection sampling method to populate the declinations. It seem to work, here are plots of the random distributions compared with the data, you can see that the distributions match:
No comments:
Post a Comment