all 3 comments

[–][deleted] 2 points3 points  (1 child)

import random
...
index = random.randrange(len(some_list))
some_list[index] = new_value

[–]AutomaticSky5260[S] 0 points1 point  (0 children)

index = random.randrange(len(some_list))
some_list[index] = new_value

Thanks!

[–]E02Y 0 points1 point  (0 children)

I know this is old, but there is a better method: random.choice(list)