public class RandomR { private double d; //distance between joints private int joints; //number of joints private double[] load; //array for loads private int default_d = 10; //default value for distance between joints private int default_joints = 5; //default value for number of joints private double min_load = 20; //min value of load created private double range = 100.0; //range for load i.e. loads created from min_load to 80 private double chance = 0.5; //probability that load is created public RandomR() { //default constructor this.d = default_d; this.joints = default_joints; this.load = new double[joints+1]; computeLoads(); } public RandomR(int d) { this(); //calls default constructor this.d = d; } public RandomR(int d, int joints) { this(d); //calls RandomR(int d) constructor this.joints = joints; this.load = new double[joints+1]; } public double[] getLoads() { return load; } public void computeLoads() { boolean none = true; //makes sure at least one load created for (int i=1; i<=joints; i++) { if (Math.random() < chance) { load[i] = Math.random()*range; //generates random numbers from 0 to Range if (load[i]