Showing results for 
Search instead for 
Did you mean: 
Helper IV
Helper IV

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.



Not applicable

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.

Helper IV
Helper IV

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

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!


Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.


Super Users Coming in August

We are excited for the next Super User season.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,126)