Select random element from list

I want to select a random element from a list and make an if operation on the selected item. Can I do them in void awake or void start?

Its unclear what you want.

1 Like

int sayi;

Random rastgele = new Random();
int sayi = rastgele.Next(1,4);

if (sayi = 1)
{ Ä°nitialSetup1}

İf else (sayı = 2)
{ Ä°nitialSetup2}

Where can I do this?

I’m not sure to understand well.

int rand = int(random(2));
    print("first setup");
}else if(rand==1){
    print("second setup");

Boolean&) ameManager.cs(57,20): error CS1525: Invalid expression term 'int

he gave an error

Well theres only one use of setup in processing. So youd have to put your condition inside the setup functions and make setup1 and setup2 functions outside your setup or draw loop.

@Criste44 Are you coding with or p5.js ?

1 Like