Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
James Bowden
1142
Views
8
Comments
Solved
Generate a random number
Discussion
How-to
Hi everyone!
I'm about as new to outsystems as I possibly can be so please go easy on me! I thought I'd make a little card game simulation for my first module but my 'shuffle' action has me stumped! Usually I'd use a random integer function but I cant find one anywhere. Does anyone know how I can generate a random number in outsystems?
Or if you're feeling extra nice, how would you shuffle the contents of a list in outsystems?
Cheers!
João Rosado
Staff
Solution
Hi all,
Check this topic:
https://www.outsystems.com/forums/discussion/9729/randomizer/
It has an extension to do that.
Regards,
João Rosado
See solution in context
Justin James
Â
MVP
The GeneratePassword() function can do it. There's also a "Random" extension floating around that can meet your needs.
J.Ja
James Bowden
Thanks Justin, where can I find extensions? The generate password isn't appropriate since I need to specify a random number between 0 and <list_length>.
Justin James
Â
MVP
James -
Go to the "Forge" (link right at the top of the screen) and search in there.
J.Ja
Admilson Tavares
Hi James,
You can also do it using an advanced query. In that case, you should do something like this:
James Bowden
That works, thanks guys!
João Portela
Staff
Hi guys,
Why generate a Random number using the database? I'm certain that you can find one component in the Forge as Justin referred, or if not it could be easily implemented in a extension.
Using the database for simple math operations as this, is not recommended. You are increasing the load of the database server when this operation can be executed easily in the server machine.
regards,
João Portela
João Rosado
Staff
Solution
Hi all,
Check this topic:
https://www.outsystems.com/forums/discussion/9729/randomizer/
It has an extension to do that.
Regards,
João Rosado
Admilson Tavares
I All.
I guess you are right João.
Despite the sql approach achieve his goal, it is not the best solution
Lets keep the database server focused to more appropriate tasks
Cheers
Admilson Tavares
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
 Loading...