new rand algo, in progress