1 #ifndef HALIDE_RANDOM_H 2 #define HALIDE_RANDOM_H 3 4 /** \file 5 * 6 * Defines deterministic random functions, and methods to redirect 7 * front-end calls to random_float and random_int to use them. */ 8 9 #include <vector> 10 11 #include "Expr.h" 12 #include "Func.h" 13 14 namespace Halide { 15 namespace Internal { 16 17 /** Return a random floating-point number between zero and one that 18 * varies deterministically based on the input expressions. */ 19 Expr random_float(const std::vector<Expr> &); 20 21 /** Return a random unsigned integer between zero and 2^32-1 that 22 * varies deterministically based on the input expressions (which must 23 * be integers or unsigned integers). */ 24 Expr random_int(const std::vector<Expr> &); 25 26 /** Convert calls to random() to IR generated by random_float and 27 * random_int. Tags all calls with the variables in free_vars, and the 28 * integer given as the last argument. */ 29 Expr lower_random(const Expr &e, const std::vector<VarOrRVar> &free_vars, int tag); 30 31 } // namespace Internal 32 } // namespace Halide 33 34 #endif 35