(lines = 1000, seed = Date.now())
| 14426 | } |
| 14427 | // todo: add seed! |
| 14428 | static makeRandomParticles(lines = 1000, seed = Date.now()) { |
| 14429 | let str = "" |
| 14430 | let letters = " 123abc".split("") |
| 14431 | const randFn = Utils._getPseudoRandom0to1FloatGenerator(seed) |
| 14432 | while (lines) { |
| 14433 | let indent = " ".repeat(Math.round(randFn() * 6)) |
| 14434 | let bit = indent |
| 14435 | let rand = Math.floor(randFn() * 30) |
| 14436 | while (rand) { |
| 14437 | bit += letters[Math.round(Math.min(randFn() * letters.length, letters.length - 1))] |
| 14438 | rand-- |
| 14439 | } |
| 14440 | bit += "\n" |
| 14441 | str += bit |
| 14442 | lines-- |
| 14443 | } |
| 14444 | return str |
| 14445 | } |
| 14446 | // adapted from https://gist.github.com/blixt/f17b47c62508be59987b |
| 14447 | // 1993 Park-Miller LCG |
| 14448 | static _getPseudoRandom0to1FloatGenerator(seed) { |
nothing calls this directly
no test coverage detected