Fix cache, improve test
Restore optional rand. It's not possible to debug with rand, breakpoint does not work anymore