#5 devlog, days 5-7
New updates:
- choose number of questions
- number generating fixed
- Daily challenge page
How I fixed number generating
How I tried before
Math.floor(Math.random()*(Math.pow(10,digits[0]))*Math.pow(10, digits[1]-digits[0]))
and
Math.floor((Math.random() * 10)*(Math.pow(10, digits[0]-1))*Math.pow(10, Math.ceil(Math.random() * digits[1]-digits[0])))
Where digits[0] is minimum number of digits and digits[1] is maximum number of digits
How it works now:
A function randomNumber gets number of decimals as paramater and the function is called
randomNumber(Math.round(Math.random() * (digits[1]-digits[0])) + digits[0])
Problems this fixes:
- Generating numbers with less digits that minimum
- generating different number of digits unequally (more digits was much more common)
Next thing to do:
- UI upgrade
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.