Middle-Square Algorithm
- Algorithm:
1.Start with a number called the seed.
(Mulailah dengan angka yang disebut benih)
2.Square it and extract the middle four digits. If the square has less than 8 digits, pad it with leading zeros until it’s eight digits long.
3.Repeat the process.
- Starting with a four digit seed, the middle square algorithm generates a sequence of random-looking numbers between 0 and 9,999. Xn+1 = middle four digits of (Xn ) 2
Tidak ada komentar:
Posting Komentar