<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def next_index(self) -> int: """Get a random index."""

        return bisect.bisect_right(self.totals, random.random() * self.total)