I have a 64 bit algorithm that uses modular multiplicative inverse and coprime numbers, and I need to convert it to 32 bit. This math is not my area, and I cannot find an online calculator, so I hope someone here can help me.

In 64 bit, I have:

multiplier_C = 6364136223846793005;
multiplier_inv_C = -4568919932995229531;
offset_C = 1442695040888963407;

These are from Knuth's linear congruential generator. I need the following:

multiplier_C must be 30 bits in size, and multiplier_inv_C must be its modular multiplicative inverse.

offset_C must be 29 or 30 bits in size, and a coprime of $2^{32}$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.