{{ ::randomlength.java |}}====== Random Segments in a Square ====== Pick two random points in a unit square. Find the distance between them. Do this a few million times to answer the question, "What is the average length of a random segment inside a square?" Helpful formula: {{::sdistance_formula.png?300|}} ====== Random Chords ====== Pick two points on a unit circle. Find the length of the cord. Do this a few million times to answer the question, "What is the average length of the chord?" ==== Hint about getting random points on unit a circle: ==== Get a random number from 0 to ''2*Math.PI'' to be a random angle (in radians, which is what you need in Java. Then get your x and y coordinates with sine and cosine: {{::screen_shot_2021-05-06_at_10.30.13_am.png?100|}} {{ ::randomlength.java |RandomLength.java}}