better random function

Signed-off-by: Alexander Skjolden <alex@plastboks.net>