Random Action

hey guys,

I've been searching for a random process in your help and I've found the Random Action there, but it seems that it's missing from the actions list.

Is it only at my environment...?

Thanks,

Guy.

Hi guy,

I take it that you’re talking about the “Generate Random Number” action in FinalBuilder 6? The action appears for me, if you type “Random” in the “Search” field on the action tab then it turns up.

Is that what you’re referring to? “Random process” isn’t a term I’m familiar with.

Regards,

Angus

Hi Angus.

Sorry, yes, I’m talking about the Generate Random Number. It doesn’t show up in my actions list.

I’m attaching a bitmap for you to see in another thread.

Thanks…

Hi Angus.

Sorry, yes, I’m talking about the Generate Random Number. It doesn’t show up in my actions list.

I’m attaching a bitmap for you to see in another thread.

Thanks…

Hi guy,

I didn't realise you were using FinalBuilder 5, sorry. I also see that you're using a fairly old build of FinalBuilder 5 (348, current build is 707.)

Unfortunately, the help for this action accidentally made it into an old build of FB 5, even though it was prerelease (Alpha) help for FB 6. That action is actually an FB 6 action. I'm really sorry for the inconvenience.

If you update to a more recent build, you'll see the help topic is not there any more.

The good news is that you can still generate random numbers, with some script.

To do this:

1) Add a new Run Script action to your project.

2) Select the new action and click on the Script Editor tab

3) Choose the OnExecute script event tab and choose script language "JavaScript" from the dropdown

4) Paste the following script in:

var range = 11;
var result = Math.ceil(Math.random() * range);
Action.SendLogMessage("Random number 1 to " + range + " is " + result);
FBVariables.MyVariable = result;

5) Change the value for "range" in the top line to the maximum value you want

6) Change "MyVariable" part of the last line to be the variable you want the value stored in.

This script will give you an integer value. If you want floating point then remove the Math.ceil() function call.


Sorry again for the inconvenience. This was due to a temporary slip-up with the help, back when we were beginning FB 6 development.

Regards,

Angus

PS I've removed the duplicate thread with the images. For future reference, to attach an image to an existing thread you can use the "Add Reply" button.