The problem is to generate random string of length 10. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

The problem is to generate random string of length 10.

The generated string must contain at least one number, at least one special character, at least one uppercase alphabet, and at least one lowercase alphabet. (use of php will be preferable)

27th Jan 2018, 6:47 AM
Dayanand Raut
Dayanand Raut - avatar
1 Answer
+ 1
1 number 1 special character 1 uppercase 1 lowercase 4 length 10 then 4*2=8 so: 1 - You can randomly generate 2 of each and randomly generate last 2 of any. 2 - You could to prepare some kind of array with 0 or 1 to know in each position if it is for one of 4 type of character. 3 - You could do that with counters too. Try to begin and share your code
27th Jan 2018, 9:43 AM
Daniel
Daniel - avatar