I’m missing a really simple bit of syntax: how to take the output of a math.random() call, and feed it to another variable:
[CODE]function Coin1() {
var m1 = Math.random()
if (m1 < 0.5) return 2; else return 3 }
Here, a score of 2 counts as “tails” and 3 as “heads”.
When we generate a report, it needs to say “Coin 1: score 3, heads” or “Coin 1: score 2, tails”. So we need to turn 2 and 3 into tails and heads, with something like:
[CODE]function numtoHT() {
if “return_of_m1” = 3, return “heads”; else return “tails” }
What is the syntax for “return_of_m1”?
Cheers
version with a more comments:
[url]http://www-personal.usyd.edu.au/~ctillam/test.htm