mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(utils.js): improve genRandomNumberBetweenIntervals performances
This commit is contained in:
parent
b8218a33d5
commit
7b99d70d98
1 changed files with 4 additions and 0 deletions
|
|
@ -142,6 +142,10 @@ function genRandomNumber (min, max) {
|
|||
// The `intervals` param must be orderer like this:
|
||||
// `[ [ 1, 4 ], [ 8, 16 ], [ 22, 25 ] ]`
|
||||
function genRandomNumberBetweenIntervals (intervals) {
|
||||
if (intervals.length === 1) {
|
||||
return genRandomNumber(intervals[0][0], intervals[0][1])
|
||||
}
|
||||
|
||||
// Compute the number of values.
|
||||
var size = 0
|
||||
intervals.forEach(function (interval) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue