Pontus Posted August 27, 2002 Posted August 27, 2002 I want a field, which contents should be randomized. I would like to have one field numeric and one alfanumeric. The randomizing should be in a range specified of me, of course. How do I do that?
CobaltSky Posted August 27, 2002 Posted August 27, 2002 Try using the Random calculation function (in either a script or a calculation formula. It returns a random value between 0 and 1. You must multiply it by the desired upper limit to achieve a defined range. You can use the Int( ) function if you want only whole numbers returned, viz: Int(Random * RangeSetValue) You can also couple the Random and Int functions with the Choose function to return a random alphanumeric character.
Pontus Posted August 27, 2002 Author Posted August 27, 2002 Oh. There are no plug-in that will make things a lot easier?
CobaltSky Posted August 27, 2002 Posted August 27, 2002 There may be plug-ins - there are certainly some that perform range and string functions. However why use an external function for 'Random' when there is an internal one... There is nothing very complicated about: Middle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", Int(Random* 35.5) + 1, 1) and it will return the random alphanumeric character you're looking for. Compared to the syntax required to make external function calls to some plug-ins, this is sweet and easy!
Pontus Posted August 27, 2002 Author Posted August 27, 2002 Thanks! I didn't really understood your first reply with a Choose command. This new one explains it a lot better...
Jeff Spall Posted August 29, 2002 Posted August 29, 2002 Hi, thanks for that. I just happened to be making a trial user access for a website and wanted to generate a random password, so I did a search on "random" and - here's the answer! I'll just combine it with a date to time out the user's trial. Nice tip, thanks! regards, Jeff
Kundinger Posted August 29, 2002 Posted August 29, 2002 Hello, To generate passwords, I use the same formula that Ray ('CobaltSky ') uses: Middle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", Int(Random* 35.5) + 1, 1) I 'concatenate' multiples of this to generate many random alphanumeric characters. This works very well. WORD of CAUTION... My work entails information systems in K-12 education institutions. I have found that 'certain' alphanumeric characters can be 'confussing' to users... especially young users... or old users that 'act' young. Some users can confuse the '0' & 'O' & 'D' and '1' & 'l' & 'I'. No matter what you tell the user, it is the 'systems' fault. This can drive a developer & support staff 'nuts'. To alleviate this... I have 'modified' the above formula by removing certain characters: Middle("23456789ABCEFGHJKMNPQRSTUVWXYZ", Int(Random* 29.5) + 1, 1) This has worked the best... I have been using it for over 3 years. Bob Kundinger
Recommended Posts
This topic is 8273 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 accountSign in
Already have an account? Sign in here.
Sign In Now