MaxwellCosta Posted May 2, 2020 Share Posted May 2, 2020 Hi, I have find a script of Markov Chain <?php $string = "Mavic Mini, un quadrirotor reprenant le design pliable de ses aînés, mais pesant cette fois moins de 250 g et disposant de la meilleure autonomie de la famille 30 minutes annoncées."; $tmp = new clsMarkov(); $tmp->makeList($string); $tmp->buildTree(); print $tmp->phraseWriter('le', 111); // phraseWriter(mot de base, nombre de mots dans le résultat) ?> On the last line the script says that the text must start with "le" and the text must be 111 words long. It would be desirable that the text how by "le" or "mini" or "pliable" and whether the text is 111 words or 95 or 56 or 365 words or randomly between 95 and 365. Can you help me please ? Thank you very well Max Quote Link to comment https://forums.phpfreaks.com/topic/310677-how-to-write-or-or-random-in-php/ Share on other sites More sharing options...
requinix Posted May 2, 2020 Share Posted May 2, 2020 How do you want to decide whether to start with "le" or "mini" or "pliable"? Randomly? Put the words into an array and use array_rand to find one. To determine a random number between 95 and 365, use rand. Quote Link to comment https://forums.phpfreaks.com/topic/310677-how-to-write-or-or-random-in-php/#findComment-1577430 Share on other sites More sharing options...
MaxwellCosta Posted May 2, 2020 Author Share Posted May 2, 2020 How to write this ? Please I don't now Thank you very much Max Quote Link to comment https://forums.phpfreaks.com/topic/310677-how-to-write-or-or-random-in-php/#findComment-1577440 Share on other sites More sharing options...
Barand Posted May 2, 2020 Share Posted May 2, 2020 1 hour ago, MaxwellCosta said: How to write this ? Start by following those two links that @requinix included for you in his reply. Quote Link to comment https://forums.phpfreaks.com/topic/310677-how-to-write-or-or-random-in-php/#findComment-1577448 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.