mirror of
https://github.com/Ratstail91/SANCTUM.git
synced 2025-11-29 02:24:27 +11:00
Working the modules into Shared, untested
This commit is contained in:
17
Shared/calc_random.js
Normal file
17
Shared/calc_random.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//initialize the exports
|
||||
exports = module.exports = {};
|
||||
|
||||
//Random
|
||||
//low - the inclusive lower bounds of the result
|
||||
//high - the inclusive higher bounds of the result
|
||||
exports.Random = function(low, high) {
|
||||
//inclusive high
|
||||
return Math.floor(Math.random() * (high - low + 1) + low);
|
||||
}
|
||||
|
||||
//Gamble (depreciated)
|
||||
//percentage - chance of winning as a percentage
|
||||
exports.Gamble = function(percentage) {
|
||||
// Random generation by %
|
||||
return exports.Random(1, 100) <= percentage;
|
||||
}
|
||||
Reference in New Issue
Block a user