Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. generateFakeCustomers() {
  2. let trades;
  3. this.networkService.get('trade').subscribe (
  4. res => trades = res[0]
  5. );
  6. let that = this;
  7. setTimeout(function() {that.generate(2000, trades)}, 4000);
  8. }
  9.  
  10. generate(limit: number, trades) {
  11. let customers = [];
  12. let words = [];
  13. let temp;
  14. let temp2 = {};
  15. for (let i = 0; i < 20000; ++i) {
  16. customers.push(trades[i]["customer"]);
  17. }
  18. //adjectives for shortname - set 1
  19. words[1] = "profuse"
  20. words[2] = "shiny"
  21. words[3] = "rapid"
  22. words[4] = "sour"
  23. words[5] = "fuzzy"
  24. words[6] = "bumpy"
  25. words[7] = "husky"
  26. words[8] = "azure"
  27. words[9] = "indigo"
  28. words[10] = "future"
  29. //set 2
  30. words[11] = "Enraged"
  31. words[12] = "Amiable"
  32. words[13] = "Bitter"
  33. words[14] = "Bewildered"
  34. words[15] = "Mushy"
  35. words[16] = "Wacky"
  36. words[17] = "Illogical"
  37. words[18] = "Fancy"
  38. words[19] = "Logical"
  39. words[20] = "Wry"
  40. //nouns for shortname
  41. words[21] = "Jabberwock"
  42. words[22] = "Warlock"
  43. words[23] = "Pawnbroker"
  44. words[24] = "Robot"
  45. words[25] = "Motorcycle"
  46. words[26] = "Cryptogram"
  47. words[27] = "Dog"
  48. words[28] = "Cat"
  49. words[29] = "Owl"
  50. words[30] = "Bear"
  51. //types
  52. words[31] = "bnk";
  53. words[32] = "trdr";
  54. words[33] = "cngl";
  55. for(let i = 0; i < limit; i++) {
  56. let shortname = String(words[Math.floor(Math.random() * 10) +1 ] +
  57. words[Math.floor(Math.random() * 10) + 11] +
  58. words[Math.floor(Math.random() * 10) + 20]);
  59. let tin = String(Math.floor(Math.random()*9999));
  60. let slsp_trdr = String(words[Math.floor(Math.random() * 4) + 27]);
  61. let custType = String(words[Math.floor(Math.random() * 4) + 30]);
  62. let ipBankNo = String(Math.floor(Math.random()*9999));
  63.  
  64. temp = {
  65. "shortName": shortname,
  66. "TIN": tin,
  67. "slsp_trdr": slsp_trdr,
  68. "custType": custType,
  69. "ipBankNo": ipBankNo,
  70. }
  71. for (let j = 0; j < 20000; j++) {
  72. temp2[i] = temp;
  73. }
  74. }
  75. console.log(JSON.stringify(temp2));
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement