Generate random number
Wondering if it's possible to generate a random number within a workflow? I tried this bit of code I found on StackOverflow, but within Workflow Designer it says that Rnd isn't declared and may be inaccessible due to its protection level
CInt(Math.Ceiling(Rnd() * 10)) + 1
Not a VB pro here, am I even on the right track?
0
-
CInt(Math.Ceiling(Microsoft.VisualBasic.Rnd() * 10)) + 10 -
Thanks, Nico! 0 -
Or CInt(Math.Ceiling(Microsoft.VisualBasic.VBMath.Rnd() * 10)) + 10 -
Personally I'd skip the VB reference altogether and use the default Random class (https://docs.microsoft.com/en-us/dotnet/api/system.random) . It has a bit more options, such as the returned type (float or integer), and passing of minimum and maximum values: New System.Random().Next(1, 10)0 -
Super cool, thanks! 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer