You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KlausWendel_GolangKurs/Go_Lektion_09/includes.go

25 lines
483 B
Go

package main
import (
"time"
"math/rand"
)
func zeigeMirDenGauß(anzahlKugeln int, anzahlTöpfchen int, töpfchenAlle *[]int) {
defer wg.Done()
var töpfchenTmpZähler int
for i := 0; i < anzahlTöpfchen-1; i++ {
if yesnotrigger := func() bool {
if rand.New(rand.NewSource(time.Now().UnixNano())).Float64() < 0.5 {
return true
} else {
return false
}
}(); yesnotrigger == true {
töpfchenTmpZähler++
}
}
(*töpfchenAlle)[töpfchenTmpZähler]++
}