Random Number Generator |Mid Square Method| ~xRay Pixy
Algorithm:
Step 1. Stating
with n (4
digits long) Digit Number.
Step 2. Squaring it.
Step 3. For 8 digit: Remove 2 lower and 2 higher-order DigitStep 4. For 7 digit: Remove 1 higher-order digit & 2 lower order.Step 5. Repeat step 2
Step 2. Squaring it.
Step 3. For 8 digit: Remove 2 lower and 2 higher-order DigitStep 4. For 7 digit: Remove 1 higher-order digit & 2 lower order.Step 5. Repeat step 2
Mistake : For 7 digit: Remove 1 higher-order digit & 2 lower order.
Another Example
¡This
method will
either begin repeatedly generating the same number or Cycle
to
a previous number in the sequence and loop indefinitely
Thank you so much for this!
ReplyDelete