random.js: Checking for a node context instead of window because node-we...

...bkit gets confused by that