Created
May 22, 2013 20:51
-
-
Save gmfc/5630794 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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