Add randint and cbr, cnl, cnewline

This commit is contained in:
kwaroran
2025-04-23 12:40:38 +09:00
parent 2ca28aff78
commit 59fdcc20b3

View File

@@ -1677,6 +1677,19 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
case 'hash':{
return ((pickHashRand(0, arra[1]) * 10000000) + 1).toFixed(0).padStart(7, '0')
}
case 'randint':{
const min = Number(arra[1])
const max = Number(arra[2])
if(isNaN(min) || isNaN(max)){
return 'NaN'
}
return (Math.floor(Math.random() * (max - min + 1)) + min).toString()
}
case 'cbr':
case 'cnl':
case 'cnewline':{
return '\\n'
}
}
}
if(p1.startsWith('random')){