lundi 29 juin 2020

Please explain python -> tuple(random.randrange(BOARD_SIZE[i]) for i in (0,1))

I understand that the codes below generate a random position from (0,1) to (48,48). I would like to understand the technique used. Is it a tuple comprehension? Great appreciate all your explanations.

import random
BOARD_SIZE=(48,48)

position = tuple(random.randrange(BOARD_SIZE[i]) for i in (0,1))
print(position)



Aucun commentaire:

Enregistrer un commentaire