Check if variable is a prime

no, i saw a shuffle thing and wanted to recreate it as close to reality as possible

actually i just found a way to do it. here it is:

int all= 100;
int x= (int(random(all-1)));
int y= all-x;

void setup(){
size(100, 100);
print(x);}

void draw(){
background(255,255,255);
fill(0,0,0);
if(all/2==x){
stop();}

if(x<y){x=x+1; y=y-1;}
if(y<x){y=y+1; x=x-1;}
ellipse(x,y,25,25);
}

Does this still relate to the prime number function?

no this method doesn’t need to change anything if it sees a prime number because it subtracts instead of deviding

thank you to e everyone who helped me

1 Like