Create "random" function in processing.js?

This function turn back a random number

IntList listRand;
void setup() {
 listRand=new IntList();
// void draw() { }

int randm(int a,int b){
int y;  
int x=int( random(a,b) );
 if (listRand.hasValue(x) == false) 
 else y=randm(a,b);
 return y;

But there isn’t the IntList in processing.js
Is there analog/equivalent of hasValue() function for arrays in processing.js?

1 Like

-a- something is wrong with the posted code,
as your question is about
why you not show us the problem code MCVE at

-b- but i see
try if that helps?
( i was looking for arraylist.shuffle() , but also not exists )

-c- is your question about

  • intlist?

or as the title says about

  • function making random?

did you check on

1 Like

yes, function making random and new random number != previous random numbers

Oh, ArrayList function contains() is the analog of hasValue() function and it’s works, thanks :slight_smile: