Random

Bonjour,
je suis en train de chercher depuis 1 heure comment programmer la méthode random(x,y) si celle ci n'avait pas existé pour produire un réel aléatoire de [-1,1!! quelqu'un pouvait m'aider??
Configuration: Windows Vista
Safari 532.5

4 réponses

  • Votes
  • Date
  • Date décroissante
  1. ce code affiche un float mais je ne sais pas ses bornes min max :
    public class unmoinsun {

    public static void main(String args[]) {
    Random rand = new Random();
    float x = rand.nextInt();
    System.out.println(x);
    }
    }