how to generate random numbers in typescript code example
Example 1: javascript random no between 2 numbers
function randomIntFromInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
Example 2: generate random number javascript
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
Example 3: javascript generate random number
Math.random();
Example 4: randint js
const Math.randint => (min,max) {
[min,max] = (max===undefined)?[0,min]:(min>max)[max,min]:[min,max];
return Math.floor(Math.random*(max-min)+min);
}