#3 Add Randomness

open
nobody
None
5
2012-07-06
2012-07-06
Anonymous
No

Index: src/pauker/program/Card.java

RCS file: /cvsroot/pauker/project/src/pauker/program/Card.java,v
retrieving revision 1.14
diff -r1.14 Card.java
135c135,145
< frontSide.setLearnedTimestamp(System.currentTimeMillis());
---
> // Math.random gives us numbers from 0.0 to 1.0
> // want random time shift depending on batch number:
> // - in batch 1: maximum a few hours
> // - in batch n: maximum n / m days
> // - what about batch * 6 hours?
> // - and +-, so we multiply random by 2 and shift it by -1 to get
> // numbers from -1.0 to 1.0
> double random = Math.random() * 2.0 - 1.0;
> long maxShift = 1000 * getLongTermBatchNumber() * 6 * 60 * 60;
> long shift = Math.round(random * maxShift);
> frontSide.setLearnedTimestamp(System.currentTimeMillis() +
shift);

Discussion