MCPcopy Create free account
hub / github.com/breck7/scroll / makeRandomParticles

Method makeRandomParticles

external/.scrollLibs.js:14428–14445  ·  view source on GitHub ↗
(lines = 1000, seed = Date.now())

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 3

splitMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected