# #include "random.h"

This page has information from files random.h and random.c.

## Contents

- Public Routines
- Public Definitions
- Introduction

## Public Routines in File random.c

#### Index

random_clause | random_nonvariable_term | random_path | random_term
random_complex_term | random_op_term | random_permutation |

#### Details

    Topform random_clause(int v, int a0, int a1, int a2, int a3,
    		     int max_depth, int max_lits);

This routin builds and returns a random clause. The arguments are like random_term(), with an extra argument giving the maximum number of literals.

    Term random_complex_term(int v, int a0, int a1, int a2, int a3,
    			     int max_depth);

This is like random_term(), except that the returned term will not be a variable or a constant. Subterms may be variables or constants.

    Term random_nonvariable_term(int v, int a0, int a1, int a2, int a3,
    			     int max_depth);

This is like random_term(), except that the returned term will not be a variable. Subterms may be variables.

    Term random_op_term(int depth);

    Ilist random_path(int length_max, int value_max);

This routine returns a random-length list of random integers. The range for the length is [1..length_max], and the range for the values is [1..value_max].

    void random_permutation(int *a, int size);

This routine places a random permtation of [0..size-1] into the array a. (The randomness is not very good.)

    Term random_term(int v, int a0, int a1, int a2, int a3,
    		 int max_depth);

This routine generates a random term, with depth <= max_depth, and with subterms of arity <= 3. The parameters [v, a0, a1, a2, a3] tells how many variables (named v0,v1,...), constants (named a0,a1,...), unary (named g0,g1,...), binary (named f0,f1,...), ternary (named h0,h1,...), symbols to select from. For example,

    random_term(3, 2, 1, 1, 0, 5)

asks for a term, of depth <= 5, with <= 3 variable, <= 2 constant, <= 1 unary, <=1 binary, and 0 ternary symbols.

## Public Definitions in File random.h

## Introduction

These are some routines I used for testing and debugging some of the low-level code. The main reason I wrote these is so that I could write and test the early code without having to input terms. Maybe I'll see how far I can go before I have to write a term parser.

And, who knows, maybe the next big breakthrough in automated theorem proving will depend on randonly generated terms!