We need to make a pure function where the pinde need to get sorted with highest to the left

please format code with </> button * homework policy * asking questions

int liste = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int index = 0;

void setup() {
size(400, 400);
frameRate(10);
blanding(0, liste);
}

void draw() {
display(0, liste);
}

void display(int plads, int talListe) {
int value = talListe[plads];
rect(40plads, height, 40, -20value);
//text();
if (plads < talListe.length-1) {
display(++plads, talListe);
}
}

void sortering() {
}

int blanding(int plads, int talListe) {
int pickRandom = int(random(0, 10));
int valueA = talListe[plads];
int valueB = talListe[pickRandom];
talListe[plads]=valueB;
talListe[pickRandom]=valueA;

if (plads < talListe.length-1) {
blanding(++plads, liste);
return talListe;
} else {
println(talListe);
return talListe;
}
}

to be honest, please copy the text from your subject/ headline into the text field below it.

Write a brief good subject line

You can go back and edit your post with the pencil icon

concerning your sorting:

please make a for-loop over all items in the liste.

check if one element is < then the next - if so swap the two

repeat this until no swapping was necessary

Remark

basically you can call sortering() in keyPressed() like here:

void keyPressed() {
  sortering();
}

Chrisir