Improved rand

Used builtin discrete distribution output
Added naïve HMM rand function