Radomize again a list

Edited: I scrapped all the context of my app and created a simplified model.

Objective: to randomize a list of number in display on a repeating group. I insist on randomizing display, and not source data.

Data is a list of numbers: {1,1,0,1,1,0,…,1,1,0} as a number field on an object.

Here is the crime scene: Bubble | No-code apps

Button triggers workflow well the first time: use the current object’s number list field and display it randomly on the repeating group.

Click again: I would expect the numbers to re-shuffle and display in a different order. However, the same order prevails and I cannot randomize again.

How can I achieve that?

Bubble’s Randomise system has been like this forever. Not sure there will be any update/fix for this as I’ve got the same issue where we need to ‘randomly’ select a piece of data but it just selects the same data each time. Very weird.

The best solution i’ve found is to use the :sorted randomly twice, so ‘data:sortedrandomly:sortedrandomly’ and that kind of works.

Maybe Bubble can help here.

3 Likes

Yeah - “do it twice” is the usual workaround.

3 Likes

Dear @help and @NigelG thanks both.

I tried to display list Parent’s group’s Dice:sorted(randomly):sorted(randomly)

Is that what you mean? If so it didn’t work:

1 Like

Isn’t it just haha

Yeah that’s what I meant. What you could do is generate a random number using the ‘Calculate Forumla’ then ‘Random String’ option and then use that as the ‘item#’ so it displays ‘item#n’ where ‘n’ is the output of the random string generated. Does that help?

2 Likes

I guess that would help, but I decided to opt for a more robust solution, turn my numbers into objects, and assign them a value randomly when needed.

Yet it looks to me like a bug, or if it’s intended to work this way, a little un-intuitive syntax.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.