Awkward Squirtle
,@,e .ºoO
- 110
- Posts
- 13
- Years
- Seen Jan 29, 2016
I suggest the formula: 0xFFFF-(pickletters(day+month*2)+day+8*(month/10+month%10)+((month-1)*30+year*365)&0xFFFF). Here the pickletters picks the sum of char value of letters of a move name (or other PBS file) where internalnumber=parameter.
This is unnecessarily complicated, and isn't guaranteed to work depending on what you pick letters out of. Why bring in something completely unrelated anyway?
Code:
t = Time.now
hash = t.day + (t.month << 5) + (t.year << 9)
srand(hash) # seed RNG with fixed value depending on date
lottery = rand(65536) # get a number
srand # reseed RNG
Nice simple procedure that does only what is necessary. You're welcome ;)
EDIT: I see it's been solved already. Either solution should be fine.