Genesys Cloud - Main

 View Only
Discussion Thread View
Expand all | Collapse all

Random Number Generation in Architect

  • 1.  Random Number Generation in Architect

    GENESYS
    Posted 11-03-2020 11:28
    As a few of you know, there is no function in Architect to generate a random number.

    There is an Idea that has been sitting around, only has 5 votes:

    https://genesyscloud.ideas.aha.io/ideas/CLINB-I-219

    I, personally, would love to see that boosted a lot higher...
    #Routing(ACD/IVR)

    ------------------------------
    George Ganahl GCP (Genesys Cloud), ICCE
    Principal PS Consultant
    Genesys
    ------------------------------


  • 2.  RE: Random Number Generation in Architect

    Posted 11-04-2020 03:01
    Thanks for pointing that out George.

    We have done this using a workaround for a customer that has the same requirement as the author of the idea, so I voted it and hopefully we can have a built-in function soon.

    Best regards
    Giovanni

    ------------------------------
    Giovanni Laino
    Lutech S.p.A.
    ------------------------------



  • 3.  RE: Random Number Generation in Architect

    GENESYS
    Posted 11-05-2020 08:33
    As a workaround, using a data action to fetch a random number from a source like http://www.randomnumberapi.com/ should be pretty straightforward to implement.

    ------------------------------
    Richard Schott
    Genesys - Employees
    ------------------------------



  • 4.  RE: Random Number Generation in Architect

    GENESYS
    Posted 11-05-2020 08:57
    There are plenty of workarounds...

    ------------------------------
    George Ganahl GCP (Genesys Cloud), ICCE
    Principal PS Consultant
    Genesys
    ------------------------------



  • 5.  RE: Random Number Generation in Architect

    Posted 11-06-2020 09:48
    There is a very simple workaround to get seconds from the time now and multiply it by any fixed number to get random number for each call.

    ------------------------------
    Abdullah Alsheikh
    Hadef Information Technology Co.
    ------------------------------



  • 6.  RE: Random Number Generation in Architect

    Posted 02-07-2023 22:34
    Hi Abdullah

    Do you have an example on how to configure this within architect

    Thanks

    David

    ------------------------------
    David Ragon
    Ethan Global Pty Ltd (t/a Ethan)
    ------------------------------



  • 7.  RE: Random Number Generation in Architect

    GENESYS
    Posted 02-08-2023 09:26
    Architect now has function to generate random numbers.  Use the Random() or RandomInt() function

    ------------------------------
    Melissa Bailey
    Genesys - Employees
    ------------------------------



  • 8.  RE: Random Number Generation in Architect

    Posted 02-08-2023 12:27

    Random functions

    You can use a random function that returns a random decimal between 0.0 and 1.0. Use this building block in decision actions to steer interaction based on whether the expression evaluates to true or false. For example, Random() < 0.25 can send 25% of interactions down one path and 75% of interactions down another path.

    You can also use a random function to retrieve an integer within a given range. This function enables you to more easily use the function in cases where an integer is required. For example, RandomInt(100) returns a random integer between 0 and 100. Negative inputs return negative integers.



    ------------------------------
    Blake Anderson | Sr. Telecom Engineer
    BEST BUY CO., INC.
    ------------------------------



  • 9.  RE: Random Number Generation in Architect

    GENESYS
    Posted 02-08-2023 13:58
    As @Melissa Bailey pointed out and @Blake Anderson spelled out, there are now functions in Architect to get random numbers.​​

    ------------------------------
    George Ganahl GCP (Genesys Cloud)
    Principal PS Consultant
    Genesys
    ------------------------------



  • 10.  RE: Random Number Generation in Architect

    Posted 05-25-2023 10:39

    RandomInt() and Random() do NOT appear to work in bot flows, even though the functions "technically" are recognized.  Ran into this yesterday.








    ------------------------------
    Brian Raynor
    Verizon Sourcing, LLC
    ------------------------------



  • 11.  RE: Random Number Generation in Architect

    GENESYS
    Posted 05-25-2023 10:51

    Yep



    ------------------------------
    Melissa Bailey
    Genesys - Employees
    ------------------------------



  • 12.  RE: Random Number Generation in Architect

    Posted 05-26-2023 02:39

    Yeah, I would just take the milliseconds from the current time then multiply it against the seconds then I would do a right or left for the number of characters I need.  You do run the risk of there being 01 or 001 values, so you would need to include a fixed number or other parts of the date time to append, multiply, etc to ensure that you get a truly large and random number as output.



    ------------------------------
    Ryan Cheesman
    Senior Manager, IT Integration Services
    Tandem Diabetes Care Inc. | positively different
    ------------------------------



  • 13.  RE: Random Number Generation in Architect

    Posted 05-26-2023 02:41

    Hi Brian

    Would it work if you generate the random number within your inbound message flow then pass it to the bot flow as an input variable?  Does it really matter where it gets generated as long as it's random?



    ------------------------------
    Vaun McCarthy
    ------------------------------



  • 14.  RE: Random Number Generation in Architect

    Posted 05-26-2023 17:46

    Thanks Vaun.   Actually I was just mentioning this not working for bots to give others a heads up.  One of many things that don't work in bot flows, but in this case you still can choose it from the expression editor.  

    I did work around the issue by doing my own "random" logic (which is far from even pseudo random, but it did meet my needs).   

    I'm using the following:  

    ToInt( Task.maxBounds * (Second( GetCurrentDateTimeUtc() ) / 60 ) )


    Where Task.maxBounds is the upper limit.   Yes, not the most "pseudo random" (especially if you keep calling it after one another), and can't support more than 60 numbers, but met my need as a temporary workaround (better would be to pull milliseconds out of GetCurrentDateTimeUtc() and then parse out the ms range, but since there is no Milliseconds() function, it would be a bit more work - and for my current needs wasn't necessary).  

    Your idea of doing this from a standard flow would definitely work as well, though I actually need a repeated list of random numbers and dont want to keep entering and exiting the bot.  Had thought about using the standard flow to generate a collection of pre-collected random numbers and just have the bot iterate through these as needed, but also overkill for my current needs.   

    But this simple "issue" does highlight how inconsistent Genesys Cloud Architect is with support between different flow types, even for something as simple as this.   Keep knocking my head in Architect against things that SHOULD be simple but instead require (sometimes elaborate) workarounds.  Definitely NOT the most intuitive interaction flow environment I've used (probably one of the least in many ways).  



    ------------------------------
    Brian Raynor
    Principal Architect
    Verizon Business Group
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources