Skip to content

Miscellaneous

墨智 edited this page Mar 20, 2015 · 4 revisions

Random.guid()

  • Random.guid()

随机生成一个 GUID。

Random.guid()
// => "662C63B4-FD43-66F4-3328-C54E3FF0D56E"

Random.guid() 的实现参考了 UUID 规范

Random.id()

  • Random.id()

随机生成一个 18 位身份证。

Random.id()
// => "420000200710091854"

Random.increment( step? )

  • Random.increment()
  • Random.increment( step )

生成一个全局的自增整数。

step

可选。

整数自增的步长。默认值为 1。

Random.increment()
// => 1
Random.increment(100)
// => 101
Random.increment(1000)
// => 1101
Clone this wiki locally