mardi 26 juillet 2016

How to pick two random numbers with no carry when adding

I'm trying to make this algorithm which inputs a lower and upper limit for two numbers (the two numbers may have different lower and upper limits) and outputs two random numbers within that range

The catch is however that when the two numbers are added, no "carry" should be there. This means the sum of the digits in each place should be no more than 9.

How can I make sure that the numbers are truly random and that no carrying occurs when adding the two numbers

Thanks a lot!




Aucun commentaire:

Enregistrer un commentaire