Advertisement
31ph4n70m

Funny_Words_Generator.php

Dec 16th, 2019
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2. // PHP solution to codeabbey challenge 72
  3. $INP1 = array_map('intval', explode(' ', "22 1838911"));
  4. $INP2 = "3 5 5 4 6 8 8 5 3 5 4 7 6 4 3 5 5 7 7 5 8 6";
  5. $INP2 = array_map('intval', explode(" ", $INP2));
  6. $CON = str_split('bcdfghjklmnprstvwxz');
  7. $VOW = str_split('aeiou');
  8. $A = 445;
  9. $C = 700001;
  10. $M = 2097152;
  11. $XN = $INP1[1];
  12. $LI = 0;
  13. $RSP = [];
  14. foreach ($INP2 as $wl) {
  15.     $WORD = "";
  16.     for ($i = 1; $i <= $wl; $i++) {
  17.         $XN = ($A*$XN + $C) % $M;
  18.         if ($i % 2 == 0) {
  19.             $LI = $XN % 5;
  20.             $WORD .= $VOW[$LI];
  21.         } else {
  22.             $LI = $XN % 19;
  23.             $WORD .= $CON[$LI];
  24.         }
  25.     }
  26.     array_push($RSP, $WORD);
  27. }
  28. echo implode(" ", $RSP);
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement