+++ /dev/null
-'use strict';
-
-const crypto = require('crypto');
-
-const rrange = 4294967296;
-
-/**
- * Return an integer, pseudo-random number in the range [0, 2^32).
- */
-
-const nextInt = function() {
- return crypto.randomBytes(4).readUInt32BE(0);
-};
-
-/**
- * Return a floating-point, pseudo-random number in the range [0, 1).
- */
-
-const rand = function() {
- return nextInt() / rrange;
-};
-
-/**
- * Return an integer, pseudo-random number in the range [0, max).
- */
-
-exports.randInt = function(max) {
- return Math.floor(rand() * max);
-};
const amatch = require('./match');
const clients = require('./redis-clients');
const config = require('../config');
-const randInt = require('./prng').randInt;
+const randomInt = require('crypto').randomInt;
const updateStats = require('./stats');
const utils = require('./utils');
Room.prototype.sendLoadTrack = function() {
this.status = Room.LOADING;
- const index = randInt(this.trackscount);
+ const index = randomInt(this.trackscount);
const room = this;
songsdb.zrange(this.roomname, index, index, function(err, res) {
const db = require('../lib/redis-clients').songs;
const http = require('http');
const parallel = require('async/parallel');
-const randInt = require('../lib/prng').randInt;
+const randomInt = require('crypto').randomInt;
const randomSlogan = require('../lib/utils').randomSlogan;
const rooms = require('../lib/rooms').rooms;
const subTask = function(genre) {
return function(callback) {
- const index = randInt(rooms[genre].trackscount);
+ const index = randomInt(rooms[genre].trackscount);
db.zrange(genre, index, index, function(err, res) {
if (err) {
return callback(err);