Randomize Stretch

This commit is contained in:
Mahdi Dibaiee 2014-09-06 20:04:49 +04:30
parent d91c4fe745
commit b5c4f8bd10
2 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@
"الگو",
"نام",
"لوگو",
"الحام",
"الهام",
"ایده",
"ناب",
"حقوق",

View File

@ -16,6 +16,14 @@ if(!String.prototype.repeat) {
}
}
var stretch = function stretch(a, n) {
var d = a;
while(d.length < n) {
d = d.concat(a.sort(function() { return Math.random() < 0.5}));
}
return d;
}
/* IPSUM GENERATOR */
var general = require('./general.json');
@ -46,14 +54,6 @@ function loremipsum(data) {
return Math.random() > 0.5;
});
var stretch = function stretch(a, n) {
var d = a;
while(d.length < n) {
d = d.concat(a);
}
return d;
}
switch(unit) {
case 'c':
r = stretch(r, amount/2);