The _.random() function produces random values between the inclusive lower and upper bounds.
Learn Lodash JS at Lodash JS Tutorial with Examples.
Learn Lodash JS at Lodash JS Tutorial with Examples.
Lodash _.random() Method Example
<!DOCTYPE html>
<html>
<head>
<title>Lodash Tutorial</title>
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.min.js"></script>
<script type="text/javascript">
// Getting array slice
var r = _.random(15);
console.log(r);
r = _.random(5, 15);
console.log(r);
</script>
</head>
<body></body>
</html>
The above HTML prints below output on the console:
8
7