Jump to content

This topic is 8037 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Have the field auto-enter a calculated result.

In the calculation, use the "random" function. This returns a number between zero and one. You can then multiply this by your maximum value, as well as adding or subtracting if necessary. For instance, to generate a random number between 5 and 10, use:

5 + (Random * 5)

Et voila.

Posted

5 + (Random * 5)

yes, but this is numeric... I think Andrew's looking for something Alphanumeric, like 7G98ASDF98S

Posted

For alphanumeric, define a global text field called gCharSet and set it equal to:

"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Then you can create an auto enter field with this formula:

Middle(gCharSet,Int(Random*36)+1,1)&

Middle(gCharSet,Int(Random*36)+1,1)&

Middle(gCharSet,Int(Random*36)+1,1)&

Middle(gCharSet,Int(Random*36)+1,1)&

Middle(gCharSet,Int(Random*36)+1,1)&

Middle(gCharSet,Int(Random*36)+1,1)&

Middle(gCharSet,Int(Random*36)+1,1)

etc.

Posted

How do you do that ....

Middle(gCharSet,Int(Random*36)+1,1)

Random * 36 generates a random number between 0 and 36. This is so because Random generates a number between 0 and 1, so when you multiply it by something, it increases the spread. Int() then changes it to an integer (drops anything after the decimal). Then you add 1 because you want a range of 1-36, not 0-35.

Then the middle function takes the above place in the field gCharSet.

So if you set your field to Middle(gCharSet,Int(Random*36)+1,1), it will take one random character from gCharSet. Doing it multiple times separated by &'s allows you to have multiple characters (as many as you wish).

This topic is 8037 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.