Resolve/C++ Catalog
AI/Random/Uniform.h
Copyright © 2010, Reusable Software Research Group, The Ohio State University

//  /*-------------------------------------------------------------------*\
//  |   Abstract Instance : Random_Uniform
//  \*-------------------------------------------------------------------*/

#ifndef AI_RANDOM_UNIFORM
#define AI_RANDOM_UNIFORM 1

///------------------------------------------------------------------------
/// Global Context --------------------------------------------------------
///------------------------------------------------------------------------

#include "AI/Random/Kernel.h"

///------------------------------------------------------------------------
/// Interface -------------------------------------------------------------
///------------------------------------------------------------------------

abstract_instance
class Random_Uniform :
    extends
	abstract_instance Random_Kernel
{
public:

    function Real Uniform_Real (
	    preserves Real a,
	    preserves Real b
	) is_abstract;
    /*!
	ensures
	    Uniform_Real = a + (b - a) * TO_REAL(self) / TO_REAL(LIMIT)
    !*/

    function Integer Uniform_Integer (
	    preserves Integer j,
	    preserves Integer k
	) is_abstract;
    /*!
	ensures
	    Uniform_Integer = j + TO_INTEGER (TO_REAL((k - j + 1) *
					TO_REAL(self) / TO_REAL(LIMIT)))
    !*/

};

#endif // AI_RANDOM_UNIFORM

Last modified: Thu Jan 11 17:05:57 EST 2007