random.js: Checking for a node context instead of window because node-webkit gets confused by that