PORCOREAL Posted April 16, 2015 at 09:36 PM Report Share #581400 Posted April 16, 2015 at 09:36 PM Boa Noite, Foi me pedido para desenvolver uma aplicação Java, chamada de Concurso que permita gerir cupoes relativos as chamadas efetuadas. A minha duvida esta na parte de Sortear o cupão vencedor, de entre os varios registados. Ou seja, como fazer um random de algo presente no arraylist e imprimir. Obrigado Link to comment Share on other sites More sharing options...
alexandre1985 Posted April 17, 2015 at 06:16 PM Report Share #581427 Posted April 17, 2015 at 06:16 PM (edited) Random rand = new Random(); int numero_aleatorio = rand.nextInt(limite_superior); em que limite_superior é um int que determina o limite superior do random que vai atribuir. Edited April 17, 2015 at 06:17 PM by alexandre1985 http://alexandre1985.github.io Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now