Generate a random number

Generate a random number

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?

The GeneratePassword() function can do it. There's also a "Random" extension floating around that can meet your needs.

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>. 
James -

Go to the "Forge" (link right at the top of the screen) and search in there.

Hi James,
You can also do it using an advanced query. In that case, you should do something like this:

That works, thanks guys!
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.

João Portela
Hi all,

Check this topic:
It has an extension to do that.

João Rosado
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
Admilson Tavares