Randomizing iteration order and limiting iteration count - for arrays

I'mnoob

Member
Could you explain more in detail? Isn't it that what you wanted was traversal the values given by the user? Is this means, randomizing the order?



Also I couldn't understand what it exactly means. Is this means, limiting the number of entries to iterate, or just repeating certain times no matter how many entries were input?
Hi, I've already made my macro with your help.

This is the another one. I want iterate value in random way. Not one by one

Also, I want to iterate it like just 25-30 etc times even if the entries are over 100+ something like this.
 

I'mnoob

Member
It seems you want to limiting the number of entries to iterate. That's simple.


Is this means, randomizing order of the entries to iterate, or randomizing something within the entry?
Randomizing order of the entries to iterate
 

Quidn

Passionate Member
Hi thanks again. I can't find something "floor(random())" how did u get this option?

You can just type in as an expression. :)
Expressions will be available only on numeric type variables and you can see the supported functions there.

I feel good that you seem to learn everything quickly and applicate well.

Screenshot_20231013_161048_MacroDroid.png
 

Quidn

Passionate Member
You can give this one a try. The action block randomize the index and limit their count with shell command.

Here's the screenrecord.

For some reason I couldn't attach a file from iceraven so here's the macro in the store.

Your PoC seems like works but very complicated escaping is needed when to use for general purpose. That's why I generally never recommend to use Shell Script action, and especially for handling variables.

And this is just my personal opinion but I doubt it could make sense to learn and practice shell commands for these days. In my experience even on Linux desktops or servers it's rare to get something complicated with just basic POSIX shell commands.
 
Last edited:

sampleuserhere

Active member
Your PoC works but very complicated escaping is needed when to use for general purpose. That's is why I don't recommend to use Shell Script action, and especially for handling variables.

Likely so, so far I only have ever used it against number and that was what I intended to begin with.


This is just my personal opinion but I doubt it could make sense to learn and practice shell commands for these days. Even on Linux desktops or servers it's rare to get something complicated with just basic POSIX shell commands.

Well probably so, thanks for letting me know.
 

Quidn

Passionate Member
Likely so, so far I only have ever used it against number and that was what I intended to begin with.

Well probably so, thanks for letting me know.
I'm sorry, I checked your macro again it doesn't seem to need any escaping. 😱

While I still don't recommend Shell Script action, anyway your macro seems to be fine for general use!
 
Top