How can I fill the blue space between two curves, for example $\sin$ and $\cos$, with random points? What if they are two BezierCurves instead of functions?

sine and cosine

  • 6
    $\begingroup$ Try this: Graphics[Point[RandomPoint[ImplicitRegion[Cos[x] <= y <= Sin[x] || Sin[x] <= y <= Cos[x], {{x, 0, 2 π}, {y, -1, 1}}], 1*^4]]]. $\endgroup$ Apr 18, 2017 at 17:28

1 Answer 1


Here is a solution equivalent to the one posted in the comments:

With[{n = 1*^4}, 
     Graphics[{Directive[Blue, AbsolutePointSize[1]], 
               Point[RandomPoint[ImplicitRegion[Between[y, {{Cos[x], Sin[x]},
                                                            {Sin[x], Cos[x]}}],
                                                {{x, 0, 2 π}, {y, -1, 1}}], n]]},
              Frame -> True]]

random points between sine and cosine

(Note that this throws a redundant RandomPoint::unbndreg message, even tho bounds have been explicitly specified in ImplicitRegion[]. You can ignore it here.)

  • $\begingroup$ It really shows amazing capabilities of Mathematica. $\endgroup$
    – yarchik
    Feb 13, 2021 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.