randi size inputs not scalar issue?

1 view (last 30 days)
I have an issue when I want a variable length I decided to give two inputs max_length and min_length. I then chose the length in the loop by choosing a random integer between these two. Although when I run it says:
*Error using randi
Size inputs must be scalar.
Could anyone tell me what the problem is.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 1 May 2014
Edited: Azzi Abdelmalek on 1 May 2014
randi(length(characters ), 1, (passwd_length-1))
passwd_length-1 should be a scalar not a vector

More Answers (0)


Find more on Loops and Conditional Statements in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by