estradaangelic80
estradaangelic80 estradaangelic80
  • 12-11-2020
  • Computers and Technology
contestada

Why does the randomNumber function only use whole numbers between 0 and 1 (basically, 0 and 1)?

Respuesta :

b1nary
b1nary b1nary
  • 12-11-2020

Answer:

The randomNumber function only uses whole numbers between 0 and 1 because those are the unspecified minimum and maximums to get random numbers. If you want a larger range, just specify the minimum and maximum.

Explanation:

Example code on how to specify a larger range, replace max and min with your maximum and minimum integers.

function getRandomArbitrary(min, max) {

 return Math.random() * (max - min) + min;

}

Answer Link

Otras preguntas

Factor the expression 81-36xy
Can you help me, please?
What contribution did Johannes Gutenberg make to European history?
Can someone pls help me
Where in the middle east do you see current sectarian conflict between sunni and shia muslims please help :(((((((((((((((((((((((((((((((((((((((((((((((((((((
Zero, a hypothetical planet, has a mass of 5.3 x 1023 kg, a radius of 3.3 x 106 m, and no atmosphere. A 10 kg space probe is to be launched vertically from its
Irrigation channels that require regular flow monitoring are often equipped with electromagnetic flowmeters in which the magnetic field is produced by horizonta
fill in the missing exponents in each box & show reasoning (5^?)^3=5^1
What was the inspiration for the Patriot Act? Bush's re-election in the fall of 2004 the terrorist attacks on September 11, 2001 an unusually high presidential
standard form of the equation x^2 + 4y^2 = 4.