import java.io.*;     // Inclusion du paquet d'E/S système
import java.util.*;   // Inclusion du paquet d'utilitaires pour 'Random'
import javax.swing.*; // Inclusion de 'swing' pour 'JOptionPane'

/**
  * Classe 'g_entier' :  VERIF. de l'emploi de la classe 'Random'
  * @author   (c) ~/2A env.
  * @version  1.0    2005.01.04
  * @since    0.90   2004.02.01
  */

public class g_entier  {

 /**
   * jout: champ public de classe <===> alias de 'System.out'
   */
  public static PrintWriter jout= new PrintWriter(System.out, true);

/**
  * Méthode principale publique 'main(...)'.
  * Elle utilise la classe 'es' pour accéder aux méthodes de classe:
  * @param args Tableau de chaînes pour ligne de commande éventuelle
  */
  public static void main(String args[]) throws IOException  {

        String txt= new String(); // <==>  String txt;

	txt  ="G_ENTIER: Verif. de 'abs', 'nextInt', 'nextLong' \n";
	txt +="          et de  'nextFloat', 'nextDouble' :\n";
	txt +="--------- (c)~/2A env. - MAJ: 2005.01.04  07H40\n\n";

	Random R = new Random();
        txt += "Simulations des tirages du Loto  [A DEBOGUER 'nextLong()' !] :\n";

	txt += "|R.nextInt()|%49 + 1      |R.nextLong()|%Integer.MAX_VALUE % 49 + 1\n\n";
	for(int i=0; i<7; ++i)
                txt += Math.abs(R.nextInt())%49+1 + "\t    \t   \t  " + (Math.abs(R.nextLong())%Integer.MAX_VALUE)%49+1+ "\n";

	txt += "\n  Simulation du Loto (A DEBOGUER la  génération redondante !):\n";
	for(int i=0; i<7; ++i)
		txt += "  "+ Integer.toString(1+R.nextInt(49)) ;

        txt += "\n\nAutres simulations   (A DEBOGUER la redondance !):\n";
	txt += "1+49*R.nextFloat()    1+49*R.nextDouble()\n\n";
	for(int i=0; i<7; ++i)
		txt += (byte)(1+ 49*R.nextFloat()) + "\t    \t   \t  "+ (byte)(1+49*R.nextDouble()) + "\n";

        jout.println(txt);
	JOptionPane.showMessageDialog(null, txt);
        es.attente();   // Stabilisation de l'écran pour lecture ...
	System.exit(0);
  }
}


