141k views
1 vote
You see the following line in glow script: v - 3.random() - 4 The value of v can be described as a random number drawn from [a,b]. (a.) What is the value of a? Submit Answer Tries 0/99 (b.) What is the value of b? Submit Answer Tries 0/99 Put the following lines into a glowscript script: Pucnerate a list of randon numbers nunber_of_numbers - 5088 randon_list - 11 for i in rangel number of numbers): random_list.appendi random() Initialize a list for bins of a histogram number_bins = 18 histo - 1 for 1 in rangel nunber_bins): histo(i) = 0 #Count the number of occurences in each bin and save it in listagram list far i in range nunber_of_numbers): index- Math.floor(random_lastfilenumber_bins: histofindexi - histofindex1 + 1 dalot the histogran f2 = gvbars Idelta=1.0/nunber_bins, calor=colar.blue) far i in ranger number_bins): f2.plot(i/number_bins, histoſil) Notice that when you copy this code to glowscript, the indents are not copied. Since indentation is very important in Python, fix the indentation in the copied code after the line that begins with for so that it looks similar to the provided code.

1 Answer

3 votes

Final answer:

The random variable v in the provided code represents a random number drawn from a range. The value of a is -3 and the value of b is determined by the specific random number generated.

Step-by-step explanation:

The random variable v in the provided code snippet 'v - 3.random() - 4' represents a random number drawn from the range [a, b].

To find the values of a and b, we can look at the code 'v - 3.random() - 4'.

  1. First, we subtract 3 from the randomly generated number, which shifts the range to [-3, b].
  2. Then, we subtract 4 from the shifted number, which further shifts the range to [a, b].

Therefore, the value of a is -3 and the value of b is determined by the specific random number generated.

User Chrisbro
by
8.1k points

No related questions found