use a smaller range for random numbers

Using 2**32 is the technically superior solution, since it minimizes the chance of multiple notes sharing a due # (which has implicates for sibiling spacing), but the large numbers are confusing to users.
This commit is contained in:
Damien Elmes 2012-04-21 08:56:56 +09:00
parent b4cf7e39b5
commit f16335ee7f

View file

@ -366,14 +366,14 @@ insert into cards values (?,?,?,?,?,?,0,0,?,0,0,0,0,0,0,0,0,"")""",
def _dueForDid(self, did, due):
conf = self.decks.confForDid(did)
# in order due?
if conf['new']['order']:
if conf['new']['order'] == NEW_CARDS_DUE:
return due
else:
# random mode; seed with note ts so all cards of this note get the
# same random number
r = random.Random()
r.seed(due)
return r.randrange(1, 2**32-1)
return r.randrange(1, max(due, 1000))
# Cards
##########################################################################