tmstring.random
code:Lua
t = textmodule.tmstring.random(length, str, seed)
モジュール
引数
table:_
変数 型 概要
1 length number 出力する文字列の長さ
2 str string 使用する文字
3 seed number シード値(整数 / 省略可)
返り値
table:_
変数 型 概要
1 t string 処理された文字列
概要
strに含まれる文字の中から、ランダムに抽出して文字列を作成する。
出力される文字列は、lengthで指定した長さとなる。
seedを指定すると、乱数のシード値を設定することができる。
例
code:lua
require("textmodule")
t1 = textmodule.tmstring.random(8, "0123456789")
debug_print(t1) -- "26859436"
t2 = textmodule.tmstring.random(10, "いろはにほへと")
debug_print(t2) -- "とはろいにととろはい"