I am trying to make a list of cues for a movie playback system.
Every time a cue is created I want to add an id
to the cue object.
(Which looks something like)
{
"name": "Cue One",
"length": 5000,
"id": xxx
}
Each cue object will get stored in a list of cues. However, I want to know the best way to generate ids
for each cue since they will ultimately be looked up, in the list, by ID.
I know I could do something like (max[cue.id for cues in cuelist] + 1
) or I could use the random
module and check to see if the randint
is not in the cues id, however I do not know what the most "legit" way to do this is.
Is there some specific technique or algorithm for this sort of problem?