Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Random Letter Generator (Advanced)

Hi Everyone.


I have 3 text labels that are set to randomly generate 1 letter each between A to F.

The user has the option to select a different letter which is also generated at random (on select) between A to F.


What I need is to figure out how to make sure that the letter generated will not be a duplicate of one of the other letters already on screen. 


Here is the code i have so far.

ClearCollect(Letters,Split("ABCDEF",""));ClearCollect(Letters1,Split("ABCDEF",""));ClearCollect(Letters2,Split("ABCDEF",""));ClearCollect(Letters3,Split("ABCDEF",""));UpdateContext({UpperCaseValue:""});Set(box1, false );Set(box2, false );Set(input3, false );Set(input2, false );Set(input1, false );Set(cover1, false );Set(cover2, false );Set(cover3, false );Set(reason1, false );Set(reason2, false );Set(reason3, false );Set(amendblock, false );Set(submitblock, false );Set(randletter,First(Shuffle(Letters)).Result);Set(randletter1,First(Shuffle(Filter(Letters,Result<>randletter))).Result);Set(randletter2,First(Shuffle(Filter(Letters,Result<>randletter,Result<>randletter1))).Result);Set(randletter3,First(Shuffle(Letters)).Result)



Any ideas on this would be great.




Re: Random Letter Generator (Advanced)

There is a function called shuffle which should do the job you're after wonderfully.


Basically to get three numbers create a table of letters and store in a collection, here called colAlphabet and then you can clearcollect like this ClearCollect(colThreeLetters,FirstN(Shuffle(colAlphabet),3))


The first N will return the first three letters from the shuffle which will ensure that none are duplicated.

Level: Powered On

Re: Random Letter Generator (Advanced)

Is it possible to use the (If) formula to exclude repeating letters which are already visible on other labels?

Helpful resources


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,071)