Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- generateFakeCustomers() {
- let trades;
- this.networkService.get('trade').subscribe (
- res => trades = res[0]
- );
- let that = this;
- setTimeout(function() {that.generate(2000, trades)}, 4000);
- }
- generate(limit: number, trades) {
- let customers = [];
- let words = [];
- let temp;
- let temp2 = {};
- for (let i = 0; i < 20000; ++i) {
- customers.push(trades[i]["customer"]);
- }
- //adjectives for shortname - set 1
- words[1] = "profuse"
- words[2] = "shiny"
- words[3] = "rapid"
- words[4] = "sour"
- words[5] = "fuzzy"
- words[6] = "bumpy"
- words[7] = "husky"
- words[8] = "azure"
- words[9] = "indigo"
- words[10] = "future"
- //set 2
- words[11] = "Enraged"
- words[12] = "Amiable"
- words[13] = "Bitter"
- words[14] = "Bewildered"
- words[15] = "Mushy"
- words[16] = "Wacky"
- words[17] = "Illogical"
- words[18] = "Fancy"
- words[19] = "Logical"
- words[20] = "Wry"
- //nouns for shortname
- words[21] = "Jabberwock"
- words[22] = "Warlock"
- words[23] = "Pawnbroker"
- words[24] = "Robot"
- words[25] = "Motorcycle"
- words[26] = "Cryptogram"
- words[27] = "Dog"
- words[28] = "Cat"
- words[29] = "Owl"
- words[30] = "Bear"
- //types
- words[31] = "bnk";
- words[32] = "trdr";
- words[33] = "cngl";
- for(let i = 0; i < limit; i++) {
- let shortname = String(words[Math.floor(Math.random() * 10) +1 ] +
- words[Math.floor(Math.random() * 10) + 11] +
- words[Math.floor(Math.random() * 10) + 20]);
- let tin = String(Math.floor(Math.random()*9999));
- let slsp_trdr = String(words[Math.floor(Math.random() * 4) + 27]);
- let custType = String(words[Math.floor(Math.random() * 4) + 30]);
- let ipBankNo = String(Math.floor(Math.random()*9999));
- temp = {
- "shortName": shortname,
- "TIN": tin,
- "slsp_trdr": slsp_trdr,
- "custType": custType,
- "ipBankNo": ipBankNo,
- }
- for (let j = 0; j < 20000; j++) {
- temp2[i] = temp;
- }
- }
- console.log(JSON.stringify(temp2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement