On a circumference of a given circle with a radius R two random points A & B are independently chosen.
What is the probability of AB being less than R ?
(In reply to
There must be a reason for the D3 rating. by Charlie)
Here's a simulation of a possible non-uniform distribution being used in each of the independent randomizations:
The randomization uses a unit circle. A random x coordinate is chosen between -1 and 1 and the y coordinate is one of the two points on the circle with that x coordinate, chosen with equal probability.
100,000 trials are done and the accumulated statistics reported every 10,000 trials:
4402/10000 = 0.4402
8689/20000 = 0.43445
13094/30000 = 0.436466666666667
17482/40000 = 0.43705
21829/50000 = 0.43658
26300/60000 = 0.438333333333333
30606/70000 = 0.437228571428571
35020/80000 = 0.43775
39395/90000 = 0.437722222222222
43785/100000 = 0.43785
The probability is about 43.8 %.
For majLoop = 1 To 10
Randomize Timer
For tr = 1 To 10000
xs1 = 4 * Rnd(1)
code1 = Int(xs1)
xv1 = xs1 - code1
If code1 Mod 2 = 0 Then xv1 = -xv1
yv1 = Sqr(1 - xv1 * xv1)
If code1 \ 2 < 1.5 Then yv1 = -yv1
xs2 = 4 * Rnd(1)
code2 = Int(xs2)
xv2 = xs2 - code2
If code2 Mod 2 = 0 Then xv2 = -xv2
yv2 = Sqr(1 - xv2 * xv2)
If code2 \ 2 < 1.5 Then yv2 = -yv2
dist = Sqr((xs1 - xs2) ^ 2 + (ys1 - ys2) ^ 2)
If dist <= 1 Then hitCt = hitCt + 1
trCt = trCt + 1
DoEvents
Next tr
Text1.Text = Text1.Text & hitCt & "/" & trCt & " = " & hitCt / trCt & crlf
Next majLoop
|
Posted by Charlie
on 2018-04-26 10:42:51 |