INNER CODE UNIT · Go
TestChain_GenerateDeterministic
mb-14/gomarkov · gomarkov_test.go:245
func TestChain_GenerateDeterministic(t *testing.T) {
chain := NewChain(2)
chain.Add(NGram{"i", "like", "bees"})
chain.Add(NGram{"i", "like", "cake"})
chain.Add(NGram{"i", "like", "pizza"})
chain.Add(NGram{"i", "like", "tacos"})
pairs := map[int64]string{
0: "cake",
1: "bees",
10: "cake",
100: "pizza",
1000: "bees",
}
for seed, expected := range pairs {
for i := 0; i < 16; i++ {
prng := rand.New(rand.NewSource(seed))
got, err := chain.GenerateDeterministic(NGram{"i", "like"}, prng)