Class: Wechat::Callback::RandomByteArray

Inherits:
Object
  • Object
show all
Extended by:
Wechat::Core::Common
Defined in:
lib/wechat/callback/random_byte_array.rb

Overview

Random Byte Array 用于生成指定长度的随机数组。

Constant Summary collapse

LENGTH =
16

Class Method Summary collapse

Class Method Details

.create(length = LENGTH) ⇒ Object

常见一个指定长度的随机字节数组。



12
13
14
15
16
17
18
# File 'lib/wechat/callback/random_byte_array.rb', line 12

def self.create(length = LENGTH)

  assert_present! :length, length

  [*0..255].sample length

end