I feel like this bit can be potentially factored into something iterative:
let textIndex1 = Math.floor(Math.random()*this._part1.length); let textIndex2 = Math.floor(Math.random()*this._part2.length); let textIndex3 = Math.floor(Math.random()*this._part3.length);
True, thanks for your input @toastedpitabread
Do you know if that’ll change/improve Big-O notation time?
This falls under DRY (don’t repeat yourself) – a saying I don’t like because I like to think positively with my reminders ahhaha (they end up being less catchy).
It’s O(n) whichever way because it’s linearly constant (one for-loop is
O(n)). It’s just more code to write and less flexible if you need to use this pattern for something else.
hahaah very true, well I appreciate you repeating yourself one more time. It should be defined DRY-to a machine… because some of us humans can use some reminders from time to time
And your explanation makes perfect sense, much appreciated