cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Robert94
Responsive Resident
Responsive Resident

How can I rand(1,40) only unique numbers, without repeating?

I want to get 40 random items from a sharepoint list based on their ID, but I don`t want them to repeat.

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @Robert94,

 

One approach could be to interact with a service like random.org and just collect such a set of unique numbers from there. This way you do not have to do this calculation in Power Automate.

 

After that you could use the array to retrieve the SharePoint list items with for example an apply to each loop and a get item action.

 

Below is an example of getting an array with 40 unique numbers in random order:

This hyperlink generates 40 unique numbers in plain text format.

https://www.random.org/integer-sets/?sets=1&num=40&min=1&max=40&seqnos=on&commas=on&order=index&form...

 

split(trim(replace(body('HTTP'), 'Set 1: ', '')), ', ')

 

randomorg_items.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,052)