https://github.com/halide/Halide
Raw File
Tip revision: e982e5cf29ad6d8addf675375fcb1bab31d8431c authored by Steven Johnson on 14 March 2019, 02:16:05 UTC
Use invalidate_cache() aggressively in multithreaded tests
Tip revision: e982e5c
Random.h
#ifndef HALIDE_RANDOM_H
#define HALIDE_RANDOM_H

/** \file
 *
 * Defines deterministic random functions, and methods to redirect
 * front-end calls to random_float and random_int to use them. */

#include "IR.h"

namespace Halide {
namespace Internal {

/** Return a random floating-point number between zero and one that
 * varies deterministically based on the input expressions. */
Expr random_float(const std::vector<Expr> &);

/** Return a random unsigned integer between zero and 2^32-1 that
 * varies deterministically based on the input expressions (which must
 * be integers or unsigned integers). */
Expr random_int(const std::vector<Expr> &);

/** Convert calls to random() to IR generated by random_float and
 * random_int. Tags all calls with the variables in free_vars, and the
 * integer given as the last argument. */
Expr lower_random(Expr e, const std::vector<std::string> &free_vars, int tag);

}  // namespace Internal
}  // namespace Halide

#endif
back to top