mass-random
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -8,3 +8,3 @@ module.exports = { | ||
}, | ||
char: function (number){ | ||
letter: function (number){ | ||
if (typeof(number) != "number"){ | ||
@@ -34,3 +34,3 @@ number = 1; | ||
}else{ | ||
string += module.exports.char(1); | ||
string += module.exports.letter(1); | ||
} | ||
@@ -37,0 +37,0 @@ } |
{ | ||
"name": "mass-random", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "nodejs random functions library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,1 +0,43 @@ | ||
A quick and easy library that allows you to get random characters, ints, floats, strings, and also a random item from statistics | ||
A quick and easy library that allows you to get random letters, ints, floats, strings, and also a random item from statistics | ||
##Random Integer | ||
``` | ||
random.int(0,1) | ||
``` | ||
##Random Float | ||
``` | ||
random.int(0,1) | ||
``` | ||
##Random Letter | ||
``` | ||
var letters = random.int(3); | ||
//letters will be equal to a string with 3 random letters from the alphabet | ||
``` | ||
##Random String | ||
``` | ||
var string = random.string(10); | ||
//string will a string 10 characters long with each character being a random number / letter | ||
``` | ||
##Random Item from stats | ||
``` | ||
var stats = new random.statistics({ | ||
bannana: 1, | ||
apple: 1 | ||
}); | ||
//or | ||
var stats = new random.statistics(['bannana', 'apple']); | ||
//There will be an equal chance that the item will be a banana or an apple | ||
var randomItem = stats.randomItem(); | ||
//Increase the weighting of the bannana by one, so it is now double the weighting of an apple. (because default weighting of a item is 1) | ||
stats.stats.bannana += 1; | ||
//Now there will be double the chance that there will be a bannana than a apple | ||
var randomItem = stats.randomItem(); | ||
``` |
3572
44