aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/random.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/random.js b/lib/random.js
index 17b74f64..21151213 100644
--- a/lib/random.js
+++ b/lib/random.js
@@ -210,6 +210,25 @@ function Random (faker, seed) {
return wholeString;
};
+ /**
+ * hexaDecimal
+ *
+ * @method faker.random.hexaDecimal
+ * @param {number} count defaults to 1
+ */
+ this.hexaDecimal = function hexaDecimal(count) {
+ if (typeof count === "undefined") {
+ count = 1;
+ }
+
+ var wholeString = "";
+ for(var i = 0; i < count; i++) {
+ wholeString += faker.random.arrayElement(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "A", "B", "C", "D", "E", "F"]);
+ }
+
+ return "0x"+wholeString;
+ };
+
return this;
}