Skip to content

Instantly share code, notes, and snippets.

@gmfc
Created May 22, 2013 20:51
Show Gist options
  • Select an option

  • Save gmfc/5630794 to your computer and use it in GitHub Desktop.

Select an option

Save gmfc/5630794 to your computer and use it in GitHub Desktop.
import javax.swing.*;
public class rand {
public static void main(String[] args) {
//Xf=(a*Xi+b)%m;
double a = 752395;
double Xi;
double m = 254;
double b = 25;
double Xf;
double i;
Xi=entrada("Xi");
i=entrada("Quantos números serão gerados?");
for(int cont = 0;cont<i;cont++){
Xf=(a*Xi+b)%m;
Xi=Xf;
JOptionPane.showMessageDialog(null, Xf);
}
}
public static double entrada(String var){
double ent;
ent = Double.parseDouble(JOptionPane.showInputDialog("entre com o valor de +"+var));
return ent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment