how do you ask matlab for a random word from dictionary?

7 views (last 30 days)
randWord=randi(length(dictionary));
i tried using the code above and it gives me number instead of a word from the dictionary

Accepted Answer

KSSV
KSSV on 2 May 2019
idx=randperm(length(dictionary),1);
randword = dictionary{idx}

More Answers (0)

Community Treasure Hunt

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

Start Hunting!