Week 5
Text Challenge #2


SmallBasicIf I have 2 normal dice and throw them together to get a combined score, what proportion of the scores will be 2 (double 1), 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12 (double 6)? Which is the most common total for the dice pair?




Se ho 2 dadi comuni e li lancio insieme per avere un punteggio cumulato, quale percentuale dei risultati sarà 2, 3, ..., 12? Qual è il totale più frequente per una coppia di dadi?

Soluzione #1

Lancia i 2 dadi per 10.000 volte conteggiando separatamente le uscite.
Visualizza i conteggi trasformati in percentuali.
For i=1 To 10000
  dado1=Math.GetRandomNumber(6)
  dado2=Math.GetRandomNumber(6)

  dado12=dado1+dado2
  uscite[dado12]=uscite[dado12]+1
EndFor

For i=2 To 12
  TextWindow.WriteLine(i + ": "+ uscite[i]/100)
EndFor
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki