39 views
in GUI Development by
Hi Team,

I want to create auto generated passwords for users with the length of six. It should contain minimum of one upper case, one lower case and one number. Does embedded wizard supports any instant methods to achieve this functionality?. If not how can we generate these kind of strings?

Regards,

Sazna.

1 Answer

0 votes
by

Hello Sazna,

Does embedded wizard supports any instant methods to achieve this functionality?

You will need to implement own routine to compose the password from random characters. If your application does not have high security requirements, you could use the pseudo random number generator function math_rand(). The following example demonstrates how to get a string of random characters A..Z. Based on this idea you can add more character ranges (digits, special characters, etc.):

// Desired number of signs in the resulting string
var int32  count = 8;
var string s;

// Compose the string of random characters
while ( count-- > 0 )
  s += char( math_rand( int32( 'A' ), int32( 'Z' )));

// 's' contains the random string
trace s;

In case of special characters, prepare a string containing the special characters and select the characters from the string using a random index:

var string specialChars = "!ยง%&/()*+#'-_.:,;";

// Desired number of signs in the resulting string
var int32  count = 8;
var string s;

// Compose the string of random characters
while ( count-- > 0 )
  s += specialChars[ math_rand( 0, specialChars.length - 1 )];

// 's' contains the random string
trace s;

I hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...