Constrained random points on a circle: Difference between revisions

Content added Content deleted
Line 13: Line 13:
The general scheme is :
The general scheme is :


1. All points satisfying the inequality are enumerated.
**1. All points satisfying the inequality are enumerated.
2. 100 points are chosen at random from this set and plotted.
**2. 100 points are chosen at random from this set and plotted.
3. To ensure that the same point is not picked twice and hence speed up the plotting, the chosen point is swapped with the last point after plotting. The new point is then chosen from the new set minus the last element. The position of this last element moves towards the head as the loop progresses.
**3. To ensure that the same point is not picked twice and hence speed up the plotting, the chosen point is swapped with the last point after plotting. The new point is then chosen from the new set minus the last element. The position of this last element moves towards the head as the loop progresses.


<lang C>
<lang C>
Line 95: Line 95:
Output will differ from system to system. A better rendering would be to use graphics libraries like OpenGL or Turbo BGI.
Output will differ from system to system. A better rendering would be to use graphics libraries like OpenGL or Turbo BGI.


<Output>
<pre>




Line 127: Line 127:
* **
* **
* **
* **
</Output>
</pre>


=={{header|D}}==
=={{header|D}}==