JSFiddle - React, Tailwind, and code Playground
by aaronk85
JavaScript
function randomRange(from, to, leng){
var tem, A= [], L= 0, i= 0;
randomRangeLoop:
while(L< leng){
tem= Math.floor(Math.random()*to)+from;
i= 0;
while(i<L){
if(A[i++]=== tem) continue randomRangeLoop;
}
A[L++]= tem;
}
return '<li>' + A + '</li>';
}
alert(randomRange(1, 10, 5))