Hi
I am using the script getRandomElement(files).
If there are 100 images, is it possible that it dont repeat an image untill all 100 are taken??
I think it keeps on repeating some images and dont open new ones........
Random Element
Moderator: Martin
Re: Random Element
Hi,
You can remove the element from the list so you don't get this element again. Something like this should work:
Regards,
Martin
You can remove the element from the list so you don't get this element again. Something like this should work:
Code: Select all
file = getRandomElement(files);
removeElementValue(files, file);
Martin
Re: Random Element
Hi martin
It is now also repeating files without completing all files.....
Please help!!
It is now also repeating files without completing all files.....
Please help!!
Re: Random Element
Hi,
Please share the flow so we can check what's going on.
Regards,
Martin
Please share the flow so we can check what's going on.
Regards,
Martin
Re: Random Element
Hi,
You could read the list of files into a global variable once a day or once a week and use a second flow that displays a random image:
Flow 1
-trigger ...
-action Init Variable File List variable global_files
Flow 2
-trigger ...
-action Script
-action Start Activity: ...{file}
Regards,
Martin
You could read the list of files into a global variable once a day or once a week and use a second flow that displays a random image:
Flow 1
-trigger ...
-action Init Variable File List variable global_files
Flow 2
-trigger ...
-action Script
Code: Select all
file = getRandomElement(global_files);
removeElementValue(global_files, file);
Regards,
Martin