I have tried to get the standard deviation, but it doesn't work.
int[]scores = {
52, 69, 85, 98, 95, 76, 82, 83, 92, 87, 94, 68, 77, 45, 70, 71, 59, 60, 74, 84, 83, 73, 75, 78, 80, 92, 91, 97, 62, 84
};
void standardDeviation() {
float average;
for (int x=0; x<scores.length; x++) {
float total = 0;
for (int i=0; i<scores.length; i++) {
total += scores[i];
}
noLoop();
float stdDeviation=0;
average=total/scores.length;
float differences = (scores[x]-average);
float squaredDifferences= differences*differences;
float variance=squaredDifferences/scores.length;
stdDeviation=+ sqrt(variance);
textFont(createFont("consolas", 20));
text("Standard Deviation: "+ stdDeviation, 20, 170);
println(stdDeviation);
noLoop();
}
}