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

40 lines
794 B

package main
import (
"github.com/01-edu/z01"
solutions "./solutions"
student "./student"
)
func main() {
functionsArray := []func(int){solutions.Add0, solutions.Add1, solutions.Add2, solutions.Add3}
type node struct {
f func(int)
arr []int
}
table := []node{}
//15 random slice of random ints with a random function from selection
for i := 0; i < 15; i++ {
functionSelected := functionsArray[z01.RandIntBetween(0, len(functionsArray)-1)]
val := node{
f: functionSelected,
arr: z01.MultRandIntBetween(-1000000, 1000000),
}
table = append(table, val)
}
table = append(table, node{
f: solutions.Add0,
arr: []int{1, 2, 3, 4, 5, 6},
})
for _, arg := range table {
z01.Challenge("ForEach", student.ForEach, solutions.ForEach, arg.f, arg.arr)
}
}