Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Code Review #11

Open
task-master98 opened this issue Feb 15, 2021 · 0 comments
Open

Code Review #11

task-master98 opened this issue Feb 15, 2021 · 0 comments

Comments

@task-master98
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant