Hi,
Can any guru out there give advice on how to create a function to generate random number in Studio X? Appreciate your advice.
Thanks in advance!
Hi,
Can any guru out there give advice on how to create a function to generate random number in Studio X? Appreciate your advice.
Thanks in advance!
Hi,
Hope the following helps you.
Note: You need to set proper random seed to Random class.
Regards,
Hi Yoichi,
Thanks for your advice! I have validation error while follow based on your screenshots. Please advice what is wrong on the Value to Save on the formula.
Hi,
Can you try “Open in Advanced Editor” in Save For Later activity as the following?
Regards,
Hi Yoichi,
Thanks for your advice! Do you know how to generate the random number as decimal?
Regards
To generate the random number in decimal, You need to change the datatype of variable from Integer to Double.
Regards
May I know the syntax? Now my syntax is (New Random).Next(36.0,37.5) which fail the validation.
Hi,
Can you try the following?
Saved.Values(Of Double)("SavedRandomNumber") = (New Random).NextDouble()*1.5+36
or
Saved.Values(Of Decimal)("SavedRandomNumber") = Decimal.Parse(((New Random).NextDouble()*1.5+36).ToString)
Regards,
Is working now and may I know how to restrict to 1 decimal place rather many decimal place?
I am using the syntax Decimal.Parse(((New Random).NextDouble()*1.5+36).ToString)
Hi,
Can you try Decimal.Parse(Math.Round((New Random).NextDouble()*1.5+36,1).ToString)
?
Regards,
Thanks you so much for your advice! It works now.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.