Last active
February 12, 2016 15:23
-
-
Save rluta/8772804cef002cd4bd03 to your computer and use it in GitHub Desktop.
Fake order generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function genOrder() { | |
var prefix = [ | |
'Funny', 'Smart', 'Ultra resistant', 'Comfortable', 'Awesome', 'Magic', 'Shiny', | |
'Slick', 'Sticky', 'Fire-proof', 'Delicate', 'Sensible', 'Sexy','Plain', 'Soft', | |
'Solid', | |
]; | |
var item = [ | |
'spandex pant','cape','costume','boots','shirts','jacket','tool belt','glove', | |
'briefs','shorts','sweater','communicator','gizmo','mask' | |
]; | |
var color = [ | |
'black','red','blue','yellow','orange','cyan','green', | |
'white','mauve','purple','grey','invisible' | |
]; | |
var customer = [ | |
'Batman','Robin','Superman','Wolverine','Mario', | |
'Ironman','Spiderman','Cyclops','Storm', | |
'Colossus','Dr Strange','Pr Xavier','Hulk' | |
]; | |
var quantities = [ | |
1,1,1,1,1,1,1,1,1,1,1,1,2,2,6 | |
]; | |
var any = function (data) { return data[Math.floor(Math.random()*data.length)]} | |
var name = function () { return any(prefix)+' '+any(item)} | |
var price = function (minVal,maxVal) { | |
return randInt(100*minVal,100*maxVal)/100; | |
} | |
return {customer: any(customer), item: name(), color: any(color), quantity: any(quantities), price: price(50,500) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment