I have to create a PRNG with these parameters "The program should generate a sequence of 1000 numbers using the following algorithm: seed = ( 1664525 * seed + 1013904223 ) % 4294967296 For each new seed, print out the decimal value of seed / 4294967296. Remember, you have to convert the long's to doubles before doing this division to get a decimal number!" and you can laugh if you want but this is what i`ve thrown together so far,
import java.util.Scanner;
public class Random
{
public static void main( String args[] )
{
Scanner input = new Scanner( System.in );
long seed ;
double seeded ;
do
{
System.out.printf("Enter a Number between -2147483648 and 2147483647") ; long num = input.nextLong() ;
seed = num ;
while ( seed >= -2147483648 && seed <= 2147483647) ;
{
for ( long seed = 0 ; seed < 1000 ; seed ++ ) ;
{
seed = (1664525 * seed + 1013904223) % 4294967296) ;
seeded = seed ;
}
System.out.printf(" %f", seeded ) ;
} } } }
this is my first year in the program doing java. I am NOT asking for anyone to do my work, that won`t help me but a nudge would. Thanx
The first problem I can see is the semicolons immediately after the while and the for. Those are almost certainly not what you want to have there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With