I made a standalone application to randomly generate string but the app always return the same string
2 次查看(过去 30 天)
显示 更早的评论
I made a function that fully works :
function generer_mdp()
liste = ['a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' ...
'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' ...
'0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '%' '!' '?' '#' '-' '_'];
numChar = input('Combien de charatère ? ');
mdp = randsample(liste, numChar);
disp(mdp)
end
Each time I run the function I got a new string. This what I expected.
Then I export it to a stand alone application but each time I run the app, the string generated is always the same (the number of charater is respected).
I do not know what to do...
2 个评论
Askic V
2023-4-13
Just a thought, do you get the same bahavior even if you put
rng shuffle
inside the function?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!