Question: FOR GO PROGRAMMING package main import ( fmt math / rand time ) func main ( ) { / / Seed the
FOR GO PROGRAMMING
package main
import
fmt
"mathrand
"time"
func main
Seed the random number generator
rand.SeedtimeNowUnix
Generate random die tosses
const numTosses
tosses : makeint numTosses
for i :; i numTosses; i
tossesi rand.Intn Simulate a die toss
Print the die values with runs marked
inRun : false
lastToss :
for i toss : range tosses
if i && toss lastToss
if inRun
fmtPrint
inRun true
else
if inRun
fmtPrintlastToss
inRun false
fmtPrinttoss
lastToss toss
Check if a run was still ongoing at the end
if inRun
fmtPrintlastToss
fmtPrintln
output
Should be
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
