Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program to implement your own (not so good) pseudorandom number generator. Your pseudorandom number generator will implement the first pseudorandom number generator

Write a Java program to implement your own (not so good) pseudorandom number generator. Your pseudorandom number generator will implement the first pseudorandom number generator from the WWII era: the middle square method developed by the mathematician and computer science pioneer John von Neumann in 1946.

The method works as follows:

Select a seed (an initial value to get things started

To generate the next number, square the current number

Let the next pseudorandom number be the middle part of the product.

For example:

X X2 Random Number

11 0121 12

12 0144 14

14 0196 19

19 0361 36

36 1296 29

29 0841 84

For your program accept as input any four digit whole number (number between 1,000 and 9,999). When you square it, remove the last two digits and the first two digits. Print out the first 50 pseudorandom numbers in the sequence.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logics For Databases And Information Systems

Authors: Jan Chomicki ,Gunter Saake

1st Edition

1461375827, 978-1461375821

More Books

Students also viewed these Databases questions

Question

4-6 Is there a digital divide? If so, why does it matter?

Answered: 1 week ago