Write a function called deez() which creates and returns an array of random length whose items are random numbers.
Example usage and output:
console.log(deez())
// [0.8029792178993878, 0.9291390188438964]
console.log(deez())
// [0.33210968307150557]
console.log(deez())
// [0.8937903294523319, 0.38640098414032686, 0.758686960140309, 0.3845423409997013]However, the following constraints MUST be respected:
- Use only vanilla JavaScript and no other language or framework.
- Avoid bracket notation (e.g.
let ligma = [],squeal[69],!+([])). - Avoid prototype/static methods from
Array,TypedArray, and their subclasses (e.g.Array.prototype.push(),Int8Array.from()). - Avoid any other prototype/static methods that create arrays (e.g.
String.prototype.split()). - Avoid array constructors (e.g.
Array(),Int8Array()). - Avoid arrays from JSON (e.g.
JSON.parse("[1, 2, 420]")). - Avoid arrays from regex results (e.g.
"registered\r\nnurse\r\n".match(/(?=(.+))\1/g)). - Avoid array-like objects (e.g.
arguments,{ 0: "Brazil", 1: "mentioned" }). - Avoid looping keywords (e.g.
for,while,do...while). deez()must not call itself.- Avoid using the Y combinator.
deez()must be a pure function (aside from random number generation).deez()must produce fresh output every time it is called.deez().length > 0must always be true.deez().every(Number.isFinite)must always be true.- Use dynamically generated randomness, not xkcd randomness.
eval()is allowed...
Link: https://gist.github.com/icylace/b08864bdd734139a87c63556ba46a2b9