@@ -146,56 +146,6 @@ module RBS
146146 #
147147 %a{annotate:rdoc:copy:Random::Formatter}
148148 module Random_Formatter
149- # <!--
150- # rdoc-file=lib/random/formatter.rb
151- # - base64(n=nil)
152- # -->
153- # Generate a random base64 string.
154- #
155- # The argument *n* specifies the length, in bytes, of the random number to be
156- # generated. The length of the result string is about 4/3 of *n*.
157- #
158- # If *n* is not specified or is nil, 16 is assumed. It may be larger in the
159- # future.
160- #
161- # The result may contain A-Z, a-z, 0-9, "+", "/" and "=".
162- #
163- # require 'random/formatter'
164- #
165- # Random.base64 #=> "/2BuBuLf3+WfSKyQbRcc/A=="
166- # # or
167- # prng = Random.new
168- # prng.base64 #=> "6BbW0pxO0YENxn38HMUbcQ=="
169- #
170- # See RFC 3548 for the definition of base64.
171- #
172- %a{annotate:rdoc:copy:Random::Formatter#base64}
173- def base64 : (?Integer? n) -> String
174-
175- # <!--
176- # rdoc-file=lib/random/formatter.rb
177- # - hex(n=nil)
178- # -->
179- # Generate a random hexadecimal string.
180- #
181- # The argument *n* specifies the length, in bytes, of the random number to be
182- # generated. The length of the resulting hexadecimal string is twice of *n*.
183- #
184- # If *n* is not specified or is nil, 16 is assumed. It may be larger in the
185- # future.
186- #
187- # The result may contain 0-9 and a-f.
188- #
189- # require 'random/formatter'
190- #
191- # Random.hex #=> "eb693ec8252cd630102fd0d0fb7c3485"
192- # # or
193- # prng = Random.new
194- # prng.hex #=> "91dc3bfb4de5b11d029d376634589b61"
195- #
196- %a{annotate:rdoc:copy:Random::Formatter#hex}
197- def hex : (?Integer? n) -> String
198-
199149 # <!-- rdoc-file=random.c -->
200150 # Generates formatted random number from raw random bytes. See Random#rand.
201151 #
@@ -208,9 +158,6 @@ module RBS
208158 | (::Range[Integer] n) -> Integer
209159 | (::Range[Numeric] n) -> Numeric
210160
211- %a{annotate:rdoc:copy:Random::Formatter#random_byte}
212- def random_bytes : (?Integer? n) -> String
213-
214161 # <!--
215162 # rdoc-file=random.c
216163 # - prng.random_number -> float
@@ -230,94 +177,6 @@ module RBS
230177 | (?::Range[Float]? n) -> Float
231178 | (?::Range[Integer]? n) -> Integer
232179 | (?::Range[Numeric]? n) -> Numeric
233-
234- # <!--
235- # rdoc-file=lib/random/formatter.rb
236- # - urlsafe_base64(n=nil, padding=false)
237- # -->
238- # Generate a random URL-safe base64 string.
239- #
240- # The argument *n* specifies the length, in bytes, of the random number to be
241- # generated. The length of the result string is about 4/3 of *n*.
242- #
243- # If *n* is not specified or is nil, 16 is assumed. It may be larger in the
244- # future.
245- #
246- # The boolean argument *padding* specifies the padding. If it is false or nil,
247- # padding is not generated. Otherwise padding is generated. By default, padding
248- # is not generated because "=" may be used as a URL delimiter.
249- #
250- # The result may contain A-Z, a-z, 0-9, "-" and "_". "=" is also used if
251- # *padding* is true.
252- #
253- # require 'random/formatter'
254- #
255- # Random.urlsafe_base64 #=> "b4GOKm4pOYU_-BOXcrUGDg"
256- # # or
257- # prng = Random.new
258- # prng.urlsafe_base64 #=> "UZLdOkzop70Ddx-IJR0ABg"
259- #
260- # prng.urlsafe_base64(nil, true) #=> "i0XQ-7gglIsHGV2_BNPrdQ=="
261- # prng.urlsafe_base64(nil, true) #=> "-M8rLhr7JEpJlqFGUMmOxg=="
262- #
263- # See RFC 3548 for the definition of URL-safe base64.
264- #
265- %a{annotate:rdoc:copy:Random::Formatter#urlsafe_base64}
266- def urlsafe_base64 : (?Integer? n, ?boolish padding) -> String
267-
268- # <!--
269- # rdoc-file=lib/random/formatter.rb
270- # - uuid()
271- # -->
272- # Generate a random v4 UUID (Universally Unique IDentifier).
273- #
274- # require 'random/formatter'
275- #
276- # Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
277- # Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
278- # # or
279- # prng = Random.new
280- # prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
281- #
282- # The version 4 UUID is purely random (except the version). It doesn't contain
283- # meaningful information such as MAC addresses, timestamps, etc.
284- #
285- # The result contains 122 random bits (15.25 random bytes).
286- #
287- # See [RFC9562](https://www.rfc-editor.org/rfc/rfc9562) for details of UUIDv4.
288- #
289- %a{annotate:rdoc:copy:Random::Formatter#uuid}
290- def uuid : () -> String
291-
292- # <!--
293- # rdoc-file=lib/random/formatter.rb
294- # - alphanumeric(n = nil, chars: ALPHANUMERIC)
295- # -->
296- # Generate a random alphanumeric string.
297- #
298- # The argument *n* specifies the length, in characters, of the alphanumeric
299- # string to be generated. The argument *chars* specifies the character list
300- # which the result is consist of.
301- #
302- # If *n* is not specified or is nil, 16 is assumed. It may be larger in the
303- # future.
304- #
305- # The result may contain A-Z, a-z and 0-9, unless *chars* is specified.
306- #
307- # require 'random/formatter'
308- #
309- # Random.alphanumeric #=> "2BuBuLf3WfSKyQbR"
310- # # or
311- # prng = Random.new
312- # prng.alphanumeric(10) #=> "i6K93NdqiH"
313- #
314- # Random.alphanumeric(4, chars: [*"0".."9"]) #=> "2952"
315- # # or
316- # prng = Random.new
317- # prng.alphanumeric(10, chars: [*"!".."/"]) #=> ",.,++%/''."
318- #
319- %a{annotate:rdoc:copy:Random::Formatter#alphanumeric}
320- def alphanumeric : (?Numeric?, ?chars: Array[String]) -> String
321180 end
322181 end
323182end
0 commit comments