min y un máximo número max . Aquí está la fórmula que usaremos. Tómese un momento para leerlo e intente comprender lo que hace este código: Math.floor(Math.random() * (max - min + 1)) + min randomRange que tome un rango myMin y myMax y devuelva un número aleatorio que sea mayor o igual que myMin , y que sea menor o igual que myMax , inclusive. randomRange debe ser igual a tu número mínimo, myMin .'
testString: 'assert(calcMin === 5, "The lowest random number that can be generated by randomRange should be equal to your minimum number, myMin.");'
- text: 'El número aleatorio más alto que puede ser generado por randomRange debe ser igual a tu número máximo, myMax .'
testString: 'assert(calcMax === 15, "The highest random number that can be generated by randomRange should be equal to your maximum number, myMax.");'
- text: 'El número aleatorio generado por randomRange debe ser un número entero, no un decimal.'
testString: 'assert(randomRange(0,1) % 1 === 0 , "The random number generated by randomRange should be an integer, not a decimal.");'
- text: 'randomRange debe usar myMax y myMin , y devolver un número aleatorio en su rango.'
testString: 'assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), "randomRange should use both myMax and myMin, and return a random number in your range.");'
```