jeudi 27 avril 2017

Formatting scanners and random generators

Random deck = new Random();
int cardtype = deck.next(52)+1;

I have an "error: next(int) has protected access in Random" on the period in the second line, I've used code with random generators before but haven't ran into this problem yet, any suggestions? Scanner scanner = new Scanner(System.in); placeholder = scanner.nextInt; the same type of situations is going on in this piece too, but with a scanner. I believe the problem is similar for both, I think this would be a quick fix if I knew how to do it right, suggestions?




Aucun commentaire:

Enregistrer un commentaire