Reimplemented the random function

Used the xorshift for 32 bits posted in https://github.com/WebDrake/xorshift