slicesim
slicesim copied to clipboard
Code Review
I am trying to understand the simulator code for a project. I am unable to figure out the logic for the get_random_slice_index() method in main.py. It contains the following piece of code:
def get_random_slice_index(vals):
i = 0
r = random.random()
while vals[i] < r:
i += 1
return i
I am unable to figure out the logic for the while loop condition. Kindly assist me in the same.