Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

random coordinates js

function getRandomInRange(from, to, fixed) {
    return (Math.random() * (to - from) + from).toFixed(fixed) * 1;
    // .toFixed() returns string, so ' * 1' is a trick to convert to number
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #coordinates #js
ADD COMMENT
Topic
Name
7+2 =