string_random.jsã¨ããã©ã¤ãã©ãªããããæ£è¦è¡¨ç¾ãä¸ããã¨ããããæºãããããªæååãçæãã¦ããã便å©ãªãã¤ã ã
ãã¢ãã¼ã¸ãããã
ãã®ã©ã¤ãã©ãªã¯javascriptç¨ã ããæ£è¦è¡¨ç¾ãæºããæååãããã¤ãçæãããã¨ããç¶æ³ã¯æ®éçã§ãããããããããã©ã¤ãã©ãªã¯æ§ã ãªè¨èªã«æ¬²ããã¨ããã
Perl
å®ã¯ãã¡ããæ¬å®¶ã£ã½ãã®ã ããèªåã®ä¸ã§ã¯ãã£ããjavascriptã®ã©ã¤ãã©ãªã¨ãã¦èªèãã¦ãã¾ã£ã¦ãããã©ãçºç¥¥ãªã®ã誰ãæãã¦ã»ããã
Common Lisp
ã¡ãªã¿ã«èªåãåããã¦ããSlackç¨ã®botã«melbotã¨ããã®ããã¦ãããã¯ä»ã®ã¨ããCommon Lispã§åãã¦ããããã®botã«ããã®æ©è½ããã£ã¦ãstring_random regexp?
ãªã©ã¨èªãæããã¨æååãããã¤ãçæãã¦ããããã¡ãªã¿ã«Common Lispç¨ã®string_randomã¯ç¡ãã£ãã®ã§èªä½ããã
Scalaã§ããããã
æ代ãä¸ããScala 3ããã£ã¦ãããScala 3ã§åãmelbotãè¦ã¦ã¿ãããåæ©è½ãå®è£ ã§ãããçºãã¦ããã¨ãScala 3ã§ã2ç³»ã§ãããã®ãã®ãã°ãã®ã©ã¤ãã©ãªã¯æ®å¿µãªãã¨ã«ç¡ãããã ããããé£ãããã¨ã«ãæ¨æºã©ã¤ãã©ãªã¯æ£è¦è¡¨ç¾ã®ããªã¼æ§é ãå®å ¨ã«é è½ãã¦ãã¦ããªãã¬ã¯ã·ã§ã³ã§ã使ããªããã¨ã«ã¯ãããªã¼ã辿ã£ã¦æååçæããã¨ããå¾æ¥ã®ææ³ã使ããªããå°ã£ãå°ã£ãã
ããããããã§ããããæ¢ãã¦ãããã¡ã«ãantimirovã¨ããæ£è¦è¡¨ç¾ã©ã¤ãã©ãªã«æµãçããããã¨ãã¨ã¯æ£è¦è¡¨ç¾ãåçã«çæããã£ã½ãã©ã¤ãã©ãªã§ããã
ãã®ã©ã¤ãã©ãªã«ã¯scalacheckãscalapropsç¨ã®ãã¤ã³ãã£ã³ã°ãå«ã¾ãã¦ãããããããã£ãã¹ã*1ç¨ã®æ©è½ãæµç¨ãããã¨ã§ãæ£è¦è¡¨ç¾ãæºããæååãçæã§ããã
import antimirov.props.Regex val r: Regex = Regex("[windymelt]{9}") r.gen.samples(listSize = 10) // => List(elmimnynn, deyywmnen, ntlnnweee, ydwwiyiiy, llmdmddtn, nwtmmnwlw, eynmmmwii, iltynniey, nddmtwiii, wwdmtddwy)
ãã£ããæåæãã«åãã¦ãã¾ã£ãããã¶ãã©ã¤ãã©ãªã®ä½è ã¯ããããç®çã§ä½¿ãããã¨ã¯æã£ã¦ããªããã ãã大å¤ãããããæ©è½ã ãå ã ãã¹ãç¨æ©è½ãªã®ã§ã·ã¼ãå¤ãåºå®ãããã§ããã®ãé¢ç½ããããã§melbotãscalaã§å®è£ ã§ãããããããªãã
çµè«
- ããããããã¨ã«ã
antimirov
ã©ã¤ãã©ãªã¨ãã®scalaprops
ãã¤ã³ãã£ã³ã°ã使ãã¨ãstring_random.js
åçã®æåãéæã§ããã
*1:ããã¹ã¦ã®æ´æ°ãã®ããã«ãèããããå ¥åãç®çã®å¦çã«ããããå ¥åããæ§è³ªã®ä¿è¨¼ãè¡ãã証æã¨ãã¹ãã®ä¸éçãªæ©è½