fork download
  1. <?php
  2.  
  3. $letters = array(
  4. 1 => 'あ',
  5. 2 => 'い',
  6. 3 => 'う',
  7. 4 => 'え',
  8. 5 => 'お',
  9. 6 => 'か',
  10. 7 => 'き',
  11. 8 => 'く',
  12. 9 => 'け',
  13. 10 => 'こ',
  14. 11 => 'さ',
  15. 12 => 'し',
  16. 13 => 'す',
  17. 14 => 'せ',
  18. 15 => 'そ',
  19. 16 => 'た',
  20. 17 => 'ち',
  21. 18 => 'つ',
  22. 19 => 'て',
  23. 20 => 'と',
  24. 21 => 'な',
  25. 22 => 'に',
  26. 23 => 'ぬ',
  27. 24 => 'ね',
  28. 25 => 'の',
  29. 26 => 'は',
  30. 27 => 'ひ',
  31. 28 => 'ふ',
  32. 29 => 'へ',
  33. 30 => 'ほ',
  34. 31 => 'ま',
  35. 32 => 'み',
  36. 33 => 'む',
  37. 34 => 'め',
  38. 35 => 'も',
  39. 36 => 'ら',
  40. 37 => 'り',
  41. 38 => 'る',
  42. 39 => 'れ',
  43. 40 => 'ろ',
  44. 41 => 'や',
  45. 42 => 'ゆ',
  46. 43 => 'よ',
  47. 44 => 'わ',
  48. 46 => 'が',
  49. 47 => 'ぎ',
  50. 48 => 'ぐ',
  51. 49 => 'げ',
  52. 50 => 'ご',
  53. 51 => 'だ',
  54. 52 => 'で',
  55. 53 => 'ど',
  56. 54 => 'ば',
  57. 55 => 'び',
  58. 56 => 'ぶ',
  59. 57 => 'べ',
  60. 58 => 'ぼ',
  61. 59 => 'ぱ',
  62. 60 => 'ぴ',
  63. 61 => 'ぷ',
  64. 61 => 'ぺ',
  65. 63 => 'ぽ',
  66. 64 => 'ざ',
  67. 65 => 'じ',
  68. 66 => 'ず',
  69. 67 => 'ぜ',
  70. 68 => 'ぞ',
  71. 69 => 'きゃ',
  72. 70 => 'きゅ',
  73. 71 => 'きょ',
  74. 72 => 'しゃ',
  75. 73 => 'しゅ',
  76. 74 => 'しょ',
  77. 75 => 'ちゃ',
  78. 76 => 'ちゅ',
  79. 77 => 'ちょ',
  80. 78 => 'にゃ',
  81. 79 => 'にゅ',
  82. 80 => 'にょ',
  83. 81 => 'ひゃ',
  84. 82 => 'ひゅ',
  85. 83 => 'ひょ',
  86. 84 => 'みゃ',
  87. 85 => 'みゅ',
  88. 86 => 'みょ',
  89. 87 => 'りゃ',
  90. 88 => 'りゅ',
  91. 89 => 'りょ',
  92. 90 => 'ぎゃ',
  93. 91 => 'ぎゅ',
  94. 92 => 'ぎょ',
  95. 93 => 'じゃ',
  96. 94 => 'じゅ',
  97. 95 => 'じょ',
  98. 96 => 'びゃ',
  99. 97 => 'びゅ',
  100. 98 => 'びょ',
  101. 99 => 'ぴゃ',
  102. 100 => 'ぴゅ',
  103. 101 => 'ぴょ',
  104. 102 => 'っ',
  105. 103 => 'ゝ',
  106. 104 => 'ゞ',
  107. 105 => 'ん'
  108. );
  109.  
  110. $name = '';
  111. $nameLength = mt_rand(2, 4);
  112. $alphabetLength = count($letters);
  113. $numberOfSpecialSymbols = 4;
  114. $doubler = 102;
  115. $reduplicator = 103;
  116. $voicedReduplicator = 104;
  117. $N = 105;
  118.  
  119. for ($i = 1; $i <= $nameLength; $i++) {
  120. if ($i == 1) {
  121. $random = mt_rand(1, $alphabetLength - $numberOfSpecialSymbols);
  122. } else {
  123. if ($random != $N) {
  124. $random = mt_rand(1, $alphabetLength);
  125. } else {
  126. $random = mt_rand(1, $alphabetLength - 1);
  127. }
  128. }
  129.  
  130. if (($random == $reduplicator)&&($random >= 46)&&($random <= 101)) {
  131. $random = $voicedReduplicator;
  132. }
  133.  
  134. if (($random == $voicedReduplicator)&&($random < 46)) {
  135. $random = $voicedReduplicator;
  136. }
  137.  
  138. echo "Выпало число {$random}, кана {$letters[$random]} \n";
  139. $name = $name . $letters[$random];
  140. }
  141. echo "-------\n";
  142. echo "Советую имя {$name} для твоей кошки - не прогадаешь!\n";
  143.  
  144. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Выпало число 35, кана も 
Выпало число 31, кана ま 
-------
Советую имя もま для твоей кошки - не прогадаешь!