5

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

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
baumannr
  • 787
  • 3
  • 10

1 Answers1

5

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.)

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574