org.apache.commons.lang.RandomStringUtils で、
ランダム生成の文字列ってCharacters will be chosen from the set of all characters.って
かかれてるけどどうなんだろうと思ってソースみてみた。
この56320とかの数字何???><
if(ch >= 56320 && ch <= 57343) { if(count == 0) { count++; } else { // low surrogate, insert high surrogate after putting it in buffer[count] = ch; count--; buffer[count] = (char) (55296 + random.nextInt(128)); } } else if(ch >= 55296 && ch <= 56191) { if(count == 0) { count++; } else { // high surrogate, insert low surrogate before putting it in buffer[count] = (char) (56320 + random.nextInt(128)); count--; buffer[count] = ch; } } else if(ch >= 56192 && ch <= 56319) { // private high surrogate, no effing clue, so skip it count++; } else { buffer[count] = ch; }
-
- -
@yoshiori hex にしてぐぐってみればわかるとおもうなー
http://wassr.jp/user/tokuhirom/statuses/51ojFw9Qqe
In [1]: hex(56320) Out[1]: '0xdc00' In [2]: hex(57343) Out[2]: '0xdfff'
サロゲート文字の判別?
もうちょっとしらべてみる。
-
- -
さっき調べた数字は下位サロゲートの範囲だった。
つまり、制御文字以外の本当にすべての文字から(サロゲートペアを使用する文字も含む)
ランダムで文字列が生成されるっぽい。
すげえな