Coding challenge

Write some code that will generate a random number between 0 and $2\pi$, then take the sin of it. Something like
r=2.0*math.pi*math.random()
y=sin(r)
should do it. Generate 1,000 of these y's and find the average of them. Can you explain your result? What about $\sin(2r)$? $\sin(100r)$?

Type your code here:


Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: