package one import ( "bytes" "github.com/onyx-and-iris/aoc2024/day-22/internal/randomiser" ) const numIterations = 2000 func Solve(buf []byte) (int, error) { r := bytes.NewReader(buf) secrets, err := parseLines(r) if err != nil { return 0, err } var sum int for _, secret := range secrets { randomiser := randomiser.New(secret) for range numIterations { randomiser.Randomise() } sum += randomiser.Secret() } return sum, nil }