package main

import (
	"fmt"
	"hash/fnv"
	"strconv"
)

func hash(id int) uint32 {
	h := fnv.New32a()
	_, _ = h.Write([]byte(strconv.Itoa(id)))
	return h.Sum32()
}
func main() {
	oldMap := [16]int{}
	newMap := [16]int{}
	for i := range oldMap {
		oldMap[i] = i % 4
		newMap[i] = oldMap[i]
	}
	newMap[0] = 4 // Only virtual bucket 0 changes owner in this teaching model.
	moduloMoves, bucketMoves := 0, 0
	for id := 0; id < 1024; id++ {
		h := hash(id)
		if h%4 != h%5 {
			moduloMoves++
		}
		b := h % 16
		if oldMap[b] != newMap[b] {
			bucketMoves++
		}
	}
	fmt.Printf("keys=1024 modulo4to5=%d moved-one-of16-buckets=%d\n", moduloMoves, bucketMoves)
	if bucketMoves == 0 || bucketMoves >= moduloMoves {
		panic("unexpected fixture distribution")
	}
}
