Commit a1d06adf by Иван Кубота

fix random seed before generating

parent 1362f47a
Pipeline #517 canceled with stage
...@@ -56,11 +56,12 @@ const quizGenerator = function(type, photo, subType) { ...@@ -56,11 +56,12 @@ const quizGenerator = function(type, photo, subType) {
}, },
_quizGenerator = function(type, photo, subType, attempt) { _quizGenerator = function(type, photo, subType, attempt) {
attempt = attempt || 0; attempt = attempt || 0;
const initialSeed = Math.random.seeded.getStringSeed();
let log; let log;
if(attempt === 0){ if(attempt === 0){
const types = quizTypes[type+(photo?'Photo':'')]; const types = quizTypes[type+(photo?'Photo':'')];
subType = probabilityRand(types); subType = probabilityRand(types);
log = quizGenerator.log = ['Random seed: '+Math.random.seeded.getStringSeed(),'Quiz generate '+type+(photo ? ' with photo':'') +' '+(subType?`${lapk(subType.type)}`:'. FAIL')]; log = quizGenerator.log = ['Random seed: '+initialSeed,'Quiz generate '+type+(photo ? ' with photo':'') +' '+(subType?`${lapk(subType.type)}`:'. FAIL')];
}else if(attempt<30){ }else if(attempt<30){
log = quizGenerator.log; log = quizGenerator.log;
log.push('\nATTEMPT FAILED!\n\n'+ log.push('\nATTEMPT FAILED!\n\n'+
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment