Skip to main content
deleted 34 characters in body
Source Link
Endenite
  • 4.1k
  • 13
  • 28

JavaScript (ES6), 3838 37 bytes

-1 byte thanks to @Arnauld

f=n=>alert(f=n=>[n,...n)||n&&f?f(Math.random()*n|0):[]] 

// Alert is replaced with consolef=n=>[n,.log to avoid the popups alert=console.log f=n=>alert(.n)||n&&f?f(Math.random()*n|0):[]]
<input type=number id=a><button onclick="fonclick="console.log(af(+a.value))">Test</button>

JavaScript (ES6), 38 bytes

f=n=>alert(n)||n&&f(Math.random()*n|0) 

// Alert is replaced with console.log to avoid the popups alert=console.log f=n=>alert(n)||n&&f(Math.random()*n|0)
<input type=number id=a><button onclick="f(a.value)">Test</button>

JavaScript (ES6), 38 37 bytes

-1 byte thanks to @Arnauld

f=n=>[n,...n?f(Math.random()*n|0):[]] 

f=n=>[n,...n?f(Math.random()*n|0):[]]
<input type=number id=a><button onclick="console.log(f(+a.value))">Test</button>

deleted 4 characters in body
Source Link
Endenite
  • 4.1k
  • 13
  • 28

JavaScript (ES6), 4038 bytes

f=n=>alert(n=Mathn)||n&&f(Math.random()*n|0)||n&&f(n) 

// Alert is replaced with console.log to avoid the popups alert=console.log f=n=>alert(n=Mathn)||n&&f(Math.random()*n|0)||n&&f(n)
<input type=number id=a><button onclick="f(a.value)">Test</button>

JavaScript (ES6), 40 bytes

f=n=>alert(n=Math.random()*n|0)||n&&f(n) 

// Alert is replaced with console.log to avoid the popups alert=console.log f=n=>alert(n=Math.random()*n|0)||n&&f(n)
<input type=number id=a><button onclick="f(a.value)">Test</button>

JavaScript (ES6), 38 bytes

f=n=>alert(n)||n&&f(Math.random()*n|0) 

// Alert is replaced with console.log to avoid the popups alert=console.log f=n=>alert(n)||n&&f(Math.random()*n|0)
<input type=number id=a><button onclick="f(a.value)">Test</button>

Source Link
Endenite
  • 4.1k
  • 13
  • 28

JavaScript (ES6), 40 bytes

f=n=>alert(n=Math.random()*n|0)||n&&f(n) 

// Alert is replaced with console.log to avoid the popups alert=console.log f=n=>alert(n=Math.random()*n|0)||n&&f(n)
<input type=number id=a><button onclick="f(a.value)">Test</button>