Class RFuzz::RandomGenerator
In: lib/rfuzz/random.rb
Parent: Object

Methods

base64   byte_array   bytes   floats   hash_of   headers   ints   new   num   queries   uris   words  

Public Class methods

new(dict=nil, type=:words)

Either initialized without a word dictionary or with one. If you initialize with a word dictionary then you can generate the random words, and is the expected behavior. You can use the "type" parameter to change the default type of generated content from words to any of the other types available [:base64,:uris,:byte_array,:ints,:floats].

The dict should just be an array of words.

Public Instance methods

base64(count,length=100)

Generates an array of base64 encoded chunks of garbage. The length=100 is the default and is a max, but the lengths are random.

byte_array(count,length=100)

Generates an array of garbage byte strings, these are binary strings so very nasty. As usual, length=100 is a max for the random lengths.

bytes(count)

Generate a single String with random binary garbage in it.

floats(count)

An array for random floats.

hash_of(count,length=5,type=@type)

Returns a random hash of type (default :words) where the key=>value is randomly generated. This is aliased for RandomGenerator.queries and RandomGenerator.headers so that it is more readable.

:words,:base64,:uris,:byte_array,:ints,:floats
are the available

types of generated hash garbage you can use. These "types" just translate to function calls on self.send(type,length).

headers(count,length=5,type=@type)

Alias for hash_of

ints(count, max = nil)

An array of integers with a default max of max. The integers are 4 bytes and pulled from network encoding so they should be cross platform (meaning tests should run the same on all platforms).

num(max)

A random number with a maximum of max.

queries(count,length=5,type=@type)

Alias for hash_of

uris(count,length=100)

Generate an array of random length URIs based on words from the dict. The default max length=100 and is the number of words to chain together into a gigantor URI. The URI starts with /.

words(count=1)

Generates an array with count number of randomly selected words from the dictionary.

[Validate]

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.