added randomness

fixed r, converted to php, added warning of browser compatibility, a LOT
more