Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
18 replies
Subscribers
9 subscribers
Views
18597 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Random Value Generation
aloks0189
Certified Lead Developer
over 8 years ago
Hi,
I would like to know, is there any function available which can generate Integer random value, based on our specified range. As there is an function Available named as rand() which do not have any parameters, and returns the value of Type Number (Decimal). although we can take out the value after . (dot) and can convert it to an Integer, but in this case also we cannot get the value based on our specified range, so we do not have any control over number of digits gets generated Randomly
For Example: rand() => returns => 0.6031346
Can be formatted as
load(
local!data: split(tostring(rand()), "."),
tointeger(local!data[2])
)
which returns: 6031346
But here user do not have opportunity to get random numbers within its specified range like,
random(100) => 99, 87 etc.....
random(1000) => 999, 124, 846 etc...
Thanks
OriginalPostID-249106
Discussion posts and replies are publicly visible
Top Replies
Stefan Helzle
over 8 years ago
+4
A Score Level 3
Something like fixed(rand()*ri!range, 0) should do it.
Stefan Helzle
over 4 years ago
in reply to
paulg0001
+2
A Score Level 3
This is how you do it. Define your range of available characters first, then select randomly. ceiling() is important to make sure the lowest number is 1. a!localVariables( local!chars: touniformstring…
Stewart Burchell
over 6 years ago
in reply to
divyaa0001
+1
Appian Employee
Yes. You'll need to do this steps: get a list of all the Users you want to randomly select - let's call this local!users derive the number of these - you can use fn!count() over the list from step…
Parents
0
aloks0189
Certified Lead Developer
over 8 years ago
Thank You @stefanh791
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
aloks0189
Certified Lead Developer
over 8 years ago
Thank You @stefanh791
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data