Along the lines of How to get this PRNG to generate numbers within the range? , I am this far (parts
is an array of 32 2-character "symbols"):
const parts = `mi
ma
mo
ne
nu
di
da
do
be
bu
ti
te
ta
to
tu
ki
ke
ka
ko
ku
si
sa
so
ze
zu
fi
fa
fo
ve
vu
xe
xu`.trim().split(/\n+/)
const fetch = (x, o) => {
if (x >= o) {
return x
} else {
const v = (x * x) % o
return (x <= (o / 2n)) ? v : o - v
}
}
const fetchLarge = (x) => fetch(x, 41223334444555556666667777777888888889999999997n)
// the last number can be anything.
const buildLarge = (x, o) => fetchLarge((fetchLarge(x) + o) % BigInt(Math.pow(32, 31)) ^ 2030507011013017019023n)
const createArray = (n, mod = 32n) => {
if (!n) return [0];
let arr = [];
while (n) {
arr.push(Number(n % mod));
n /= mod;
}
return arr;
}
const write = (i) => {
const x = buildLarge(i++, 272261127249452727280272961627319532734291n)
return createArray(x).map(x => parts[x]).join('')
}
let i = 1n
while (i < 10000) {
console.log(write(i))
}
I am generating results along the lines of:
kitekutefaxunetotuzezumatotamabukidimasoxumoxudofasositinu,6038940986212279582529645303138677298679151
sokiketufikefotekakidotetotesamizununetefokixefitetisovene,5431347628569519336817719657935192515363318
xudamituzesimixuxemixudakedatetutununekobuzexesozuxedinenu,5713969289948157459645315228321450728816863
dazenenemovudadikukatatakibekaxexemovubedivusidatafisasine,5082175912370834928186684152014555456835302
xufotidosokabunudomimibefisimakusimokedamomazexekofomokane,4925740069222414438181195472381794794580863
sodozekadakuzemaxetexukuzumisikitazufitizexekatetotuxusone,5182433137814021540565892366585827483507958
kikokasatudatidatufikizesadimatakakatudisibumofotuzutaze,1019165422643074024784461594259815846823503
dakikinetofonexesimavufafisaxefosafisikofotasanekovetevu,1279315636939618596561544978621478602915302
kinunebebuzukokemidatekobusofokikozukobedodakesisikunuki,659622269329577207976266617866288582888591
sozesifamoxebusitotesisasizekudasomitatavudidizukadimate,480714979099063166920265752208932468511478
xumakikofakumixefotisikunumovudafasofikimozenudafosidaka,749508057657951412178315361964670398839871
dazedokutituzufakebutifokekusobuzutemanesadafadatetitamo,103886097260879003150138325027254855900902
xukemizukozefaxetudizukedimotevubesitekitavukakevutisibe,376136321524704717800574424940622855799327
dozexedivenudifabuvedavebukeketozukumasimakuvetuketomafaxe,42948292938975784099596927092482269526555367
mimasatukidisodifikekutovumazefikefonemofimotesonusazexuxe,43196343143305047528500657761292227037320224
zedafimasobukudizedozefoketuzekisadotufikudadokisakedofoxe,43000150124549846140482724444846720574088407
kisafimosotuvuvuzuzukodibevutemidazusisamokososikomofavuma,2692423943832809210699522830552769656612527
soxutokonebusidaketesomoxemibesonubudibekunumatifokokanemo,2942202721014541374299446744441542204274678
xusikematetemititafafakuxusinekefoketonebetokudonesomosama,2312137916289687577537008913213461971911327
How can I make it so all strings are of length 31 "symbols" (since symbols are 2 characters in this example, that is a total of 62 characters), like this:
xusikematetemititafafakuxusinekexusikematetemititafafakuxusine
That is: What should the 3 large bigint numbers be above in the algorithm? Also, what should they be so the distribution appears random? I noticed that using large numbers close to the boundary resulted in much better apparently-randomized results, compared to smaller numbers. Also, you can't just prefix the bigint x
with 0's, which would result in mamamamamama...
. Finally, there can at most be 2 pairs of same letters in a sequence, which I assume you can only really solve by just skipping over the results that don't fit that constraint (unless there is some math magic that can somehow tell if more than two of these 32 "symbols" appear next to each other).
Regarding the last part, these are valid results:
mamavumamavumama...
nanavumamavuvuma...
These are not valid:
mamamavumamavuma...
mavuvuvumamavuma...
Because there are 3 pairs in a row that are the same.
To summarize:
- How to make it so all strings are 62 characters in length, without padding with zeroes? That means it must fit within some range of BigInts I'm not too sure about.
- So that the distribution appears enormously random (i.e. so we don't get just the tail tip of the sequence changing slowly, but instead the entire number seems to completely change, as the examples show).
- So that no more than two pairs are similar in a sequence? This part can just be solved by skipping results we find in the pseudo-randomized sequence, unless there is some magic to accomplish it that I'm not possibly fathoming :) For example, maybe there is some magic to do with multiples of similar 5-bit chunks or something, I don't know. But don't need to get fancy, skipping the results that match a regex is fine too.