demsp
July 18, 2019, 6:42am
1
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)
{
listRand.append(x);
y=x;
}
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
kll
July 18, 2019, 7:23am
2
-a- something is wrong with the posted code,
as your question is about
processing.js
why you not show us the problem code MCVE at
https://www.openprocessing.org
-b- but i see
http://processingjs.org/reference/ArrayList/
try if that helps?
( i was looking for arraylist.shuffle() , but also not exists )
-c- is your question about
or as the title says about
did you check on
http://processingjs.org/reference/randomSeed_/
1 Like
demsp
July 18, 2019, 7:46am
3
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
2 Likes