The BAP Microexecution Framework
type t = generator
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val of_iterator : ?width:int -> ?seed:( int -> 'a ) -> to_bitvec:( 'd -> Bitvec.t ) -> (module Iterator.Infinite with type dom = 'd and type t = 'a) -> 'a -> t

of_iterator iter init creates a generator from a generic iterator.

The generic iterator iter may use any type as its domain (as long as it provides the projection to Bitvec.t). The type of the generator state is also abstract.

  • since 2.1.0
val create : ?width:int -> (module Iterator.Infinite with type dom = int and type t = 'a) -> 'a -> t

create (module Iterator) seed creates a integer generator from the provided Iterator, and initializes it with the given seed.

  • parameter width

    is the width in bits of the generated words.

    Note, that the generator domain is defined by the Iterator domain, not by the width parameter of the the generator.

val static : ?width:int -> int -> t

static value returns a generator that always produces the same value.

val unfold : ?width:int -> ?min:int -> ?max:int -> ?seed:int -> f:( ('a * int) -> 'a * int ) -> 'a -> t

unfold ~min ~max ~seed ~f creates a generator that generates values by applying a function f to a pair of a generator state and previous value.

val width : t -> int

width the size in bits of the generated words.

module Random : sig ... end

Random Number Generators

module Make (Machine : Machine.S) : sig ... end

Make(Machine) lifts the generator interface into the Machine monad.