I would recommend to use a safer method: http://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback

This implementation is not really random: https://github.com/klughammer/node-randomstring/blob/master/lib/randomstring.js