Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generate random random number with fixed length

function getRandumNumber(length) {
    const min = Math.pow(10, (length-1));
    const max = Math.pow(10, (length));
    return Math.floor(Math.random() * (max - min) + min);
}

const num = getRandumNumber(3);
Source by javascriptf1.com #
 
PREVIOUS NEXT
Tagged: #generate #random #random #number #fixed #length
ADD COMMENT
Topic
Name
1+1 =