#I don't think my random function is working (command line is throwing "Error: cannot find symbol)

7 messages · Page 1 of 1 (latest)

lilac plume
#

I'm working on a project right now and I'm following the guide at https://www.geeksforgeeks.org/generating-random-numbers-in-java/ but when compiling it doesn't seem to want to work to generate random integers. What am I doing wrong? I'm not sure how much to attach but here's my current work in progress. (posting in comment because of character limit)

#

wait i cant send it

#

but its a code block

#
        return (r1.nextInt(15) + 10);
    }
    
    private int SetATK() {
        return (r1.nextInt(5) + 5);
    }
    
    private int SetDEF() {
        return (r1.nextInt(10) + 5);
    }
    
    private int SetAGI() {
        return (r1.nextInt(7) + 3);
    }
    
    private int SetACC() {
        return (r1.nextInt(7) + 3);
    }
    
    public void SetMaxHP(int maxHP) {
        this.maxHP = maxHP;
    }```
#

okay so it needs to be in pieces

#
        this.LVL = (this.LVL + 1);
        this.maxHP = (this.maxHP + r1.nextInt(3));
        this.ATK = (this.ATK + r1.nextInt(3));
        this.DEF = (this.DEF + r1.nextInt(3));
        this.AGI = (this.AGI + r1.nextInt(3));
        this.ACC = (this.ACC + r1.nextInt(3));
        this.currentHP = this.maxHP;
    }```
#

and the initialization: