Skip to main content
Community site session details

Community site session details

Session Id : jKdSEbG35D+CahgJLIXVJD
Power Automate - General Discussion
Answered

Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

Like (0) ShareShare
ReportReport
Posted on 25 Jan 2017 11:51:43 by 1,724

I want to get a random number between 1 and 2 with same probability.

 

The rand(1,2) function of Windows Definition Language seems to return 1 only, not return 2.

 

My flow for "Up and Down"

Now I use rand(1,3) instead of rand(1,2)

1.png

 

 

 

Does rand(1,2) return between 1 and 2 with same probability ? or need rand(1, 3) for return between 1 and 2 ?

 

Regards,

Yoshihiro Kawabata

Categories:
  • Community Power Platform Member Profile Picture
    on 03 Sep 2018 at 10:18:42
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi yoshihirok

     

    I have created a Microsoft Flow that reads a MS Forms request and then creates a task card in MS Planner. For each request that comes in I would like to give it a random unique number so it can be tracked.

     

    In my create a task section, the assigned user id can have an expression provided, which is where I have tried the rand function rand(1:int,10:int) but MS Flow has said that this is not a valid expression.

     

    Can you please help me to write the rand expression correctly, so I can give each created task a random unique number id?

     

    Kind Regards, 

     

    JB

     

    The image below shows the MS Flow requirements for rand and where I am trying to write the expression

     

    Capture.PNG

  • Community Power Platform Member Profile Picture
    on 03 Sep 2018 at 09:43:46
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Capture.PNG

     

    Hi yoshihirok 

     

    I am trying to use the rand function in my MS Flow to generate a random unique number id within the Assigned User ID section of the Create a Task Action. The file is read from MS forms and the task is being created as a card in MS Planner. 

     

    MS Flow explains rand as rand(minValue:integer, maxValue: integer), so I have tried the following in my flow:

     

    rand(1:int,10:int)

    but it keeps saying invalid expression.

     

    Can you please advice how I can create a random unqiue number id using an expression within Assigned User ID tab for the Create a Task Action?

     

     

    Many Thanks,

     

    JB 

  • Verified answer
    yoshihirok Profile Picture
    1,724 on 03 Feb 2017 at 07:08:03
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi @v-monli-msft

     

    My result is that rand() function return first parameter value and 2nd parameter value -1.

    In result does not include 2nd parameter.

     

    My test:

      @rand(1,10) result send Power BI Service streaming dataset per 1 minutes, 100 times.

      and build a report the count of each result value.

     

    1.png2.png

     

    I can know rand function return value of Windows Definition Language.

    and I enjoy the cooperate between Microsoft Flow to Power BI Service streaming dataset .

     

    Regards,

    Yoshihiro Kawabata

  • yoshihirok Profile Picture
    1,724 on 26 Jan 2017 at 09:41:39
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi @v-monli-msft

     

    30 times result of @rand(1,5) between 1 to 4, no 5.

    1.png

    My test is that Add rand(1,5) result to Power BI Service Dataset per 1 minute dualing 30 minutes.

     

    Regards,

    Yoshihiro Kawabata 

     

     

     

     

     

     

     

  • yoshihirok Profile Picture
    1,724 on 26 Jan 2017 at 09:39:41
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi @v-monli-msft

     

    30 times result of @rand(1,5) between 1 to 4, no 5.

    1.png

     

     

     

     

     

     

     

     

     

  • yoshihirok Profile Picture
    1,724 on 26 Jan 2017 at 09:39:29
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi @v-monli-msft

     

    30 times result of @rand(1,5) between 1 to 4, no 5.

     

     

     

     

     

     

     

  • yoshihirok Profile Picture
    1,724 on 26 Jan 2017 at 09:39:00
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi @v-monli-msft

     

    30 times result of @rand(1,5) between 1 to 4, no 5.

     

     

  • yoshihirok Profile Picture
    1,724 on 26 Jan 2017 at 08:46:48
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi @v-monli-msft, Thank you for your reply

     

    In document

    rand: "This is used to generate a random integer within the specified range"

    https://docs.microsoft.com/en-us/rest/api/logic/definition-language

     

    "rand" return integer.

    but, there are no-probability description.

     

    Regards,

    Yoshihiro Kawabata

  • v-monli-msft Profile Picture
    on 26 Jan 2017 at 08:12:32
    Re: Does "@rand(1,2)" of Windows Definition Language return 1 to 2 with same Probability ?

    Hi Yoshihirok,

     

    rand(1,2) should return 1 and 2. But I think rand(1,2) will only return integer right? My apologize for not quite familiar with Windows Definition Language. 

     

    Regards,

    Mona

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete