///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2006-01-16
// Updated : 2007-08-30
// Licence : This source is under MIT License
// File    : glm/gtx/random.h
///////////////////////////////////////////////////////////////////////////////////////////////////
// Dependency:
// - GLM core
// - GLM_GTX_vecx
// - GLM_GTX_half_float
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef glm_gtx_random
#define glm_gtx_random

// Dependency:
#include "../../glm.h"
#include "../gtx/half_float.h"
//#include "../gtx/vecx.h"

namespace glm
{
	template <typename T> T signedRand1GTX();
	template <> float signedRand1GTX();
	template <> double signedRand1GTX();
	template <typename T> detail::tvec2<T> signedRand2GTX();
	template <typename T> detail::tvec3<T> signedRand3GTX();
	template <typename T> detail::tvec4<T> signedRand4GTX();
	//template <int N, typename T> detail::_xvecxGTX<N, T> signedRandGTX();

    template <typename T> detail::tvec2<T> normalizedRand2GTX();
	template <typename T> detail::tvec2<T> normalizedRand2GTX(T Min, T Max);

    template <typename T> detail::tvec3<T> normalizedRand3GTX();
    template <typename T> detail::tvec3<T> normalizedRand3GTX(T Min, T Max);

	template <typename T> T compRand1GTX();
	template <> float compRand1GTX();
	template <> double compRand1GTX();
	template <typename T> T compRand1GTX(T Min, T Max);
	template <typename T> detail::tvec2<T> compRand2GTX(T Min, T Max);
	template <typename T> detail::tvec3<T> compRand3GTX(T Min, T Max);
	template <typename T> detail::tvec4<T> compRand4GTX(T Min, T Max);
	//template <int N, typename T> detail::_xvecxGTX<N, T> compRandGTX(T Min, T Max);
	template <typename T> detail::tvec2<T> compRand2GTX(const detail::tvec2<T>& Min, const detail::tvec2<T>& Max);
	template <typename T> detail::tvec3<T> compRand3GTX(const detail::tvec3<T>& Min, const detail::tvec3<T>& Max);
	template <typename T> detail::tvec3<T> compRand4GTX(const detail::tvec4<T>& Min, const detail::tvec4<T>& Max);
	//template <int N, typename T> detail::_xvecxGTX<N, T> compRandGTX(const detail::_xvecxGTX<N, T>& Min, const detail::_xvecxGTX<N, T>& Max);

	template <typename T> detail::tvec2<T> vecRand2GTX();
	template <> detail::tvec2<float> vecRand2GTX();
    template <> detail::tvec2<double> vecRand2GTX();
	template <typename T> detail::tvec2<T> vecRand2GTX(T MinRadius, T MaxRadius);

	template <typename T> detail::tvec3<T> vecRand3GTX();
    template <typename T> detail::tvec3<T> vecRand3GTX(T MinRadius, T MaxRadius);

	template <typename T> detail::tvec4<T> vecRand4GTX();
	template <> detail::tvec4<float> vecRand4GTX();
    template <> detail::tvec4<double> vecRand4GTX();
    template <typename T> detail::tvec4<T> vecRand4GTX(T MinRadius, T MaxRadius);

    template <typename T> T gaussRand1GTX(T mean, T std_deviation);
    template <typename T> detail::tvec2<T> gaussRand2GTX(T mean, T std_deviation);
    template <typename T> detail::tvec3<T> gaussRand3GTX(T mean, T std_deviation);
    template <typename T> detail::tvec4<T> gaussRand4GTX(T mean, T std_deviation);
    template <typename T> detail::tvec2<T> gaussRand2GTX(const detail::tvec2<T>& mean, T std_deviation);
    template <typename T> detail::tvec3<T> gaussRand3GTX(const detail::tvec3<T>& mean, T std_deviation);
    template <typename T> detail::tvec4<T> gaussRand4GTX(const detail::tvec4<T>& mean, T std_deviation);
    template <typename T> detail::tvec2<T> gaussRand2GTX(T  mean, const detail::tvec2<T>& std_deviation);
    template <typename T> detail::tvec3<T> gaussRand3GTX(T  mean, const detail::tvec3<T>& std_deviation);
    template <typename T> detail::tvec4<T> gaussRand4GTX(T  mean, const detail::tvec4<T>& std_deviation);
    template <typename T> detail::tvec2<T> gaussRand2GTX(const detail::tvec2<T>& mean, const detail::tvec2<T>& std_deviation);
    template <typename T> detail::tvec3<T> gaussRand3GTX(const detail::tvec3<T>& mean, const detail::tvec3<T>& std_deviation);
    template <typename T> detail::tvec4<T> gaussRand4GTX(const detail::tvec4<T>& mean, const detail::tvec4<T>& std_deviation);

	namespace gtx
	{
		//! GLM_GTX_random extension: Generate random number from varius distribution methods
		namespace random
		{
            template <typename T> inline T signedRand1(){return signedRand1GTX<T>();}                                                                                   //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
			template <> inline float signedRand1(){return signedRand1GTX<float>();}                                                                                     //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
	        template <> inline double signedRand1(){return signedRand1GTX<double>();}                                                                                   //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec2<T> signedRand2(){return signedRand2GTX<T>();}                                                                           //!< \brief Generate 2 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec3<T> signedRand3(){return signedRand3GTX<T>();}                                                                           //!< \brief Generate 3 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec4<T> signedRand4(){return signedRand4GTX<T>();}                                                                           //!< \brief Generate 4 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)
	        //template <int N, typename T> inline detail::_xvecxGTX<N, T> signedRand(){return signedRandGTX<N, T>();}                                                             //!< \brief Generate N random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension)

			template <typename T> detail::tvec2<T> normalizedRand2(){return normalizedRand2GTX<T>();}                                                                          //!< \brief Generate a normalized 2D vector regulary distribute on a circle (From GLM_GTX_random extension)
			template <typename T> detail::tvec2<T> normalizedRand2(T Min, T Max){return normalizedRand2GTX(Min, Max);}                                                         //!< \brief Generate a scaled and normalized 2D vector regulary distribute on a circle (From GLM_GTX_random extension)
			template <typename T> detail::tvec3<T> normalizedRand3(){return normalizedRand3GTX<T>();}                                                                          //!< \brief Generate a normalized 3D vector regulary distribute on a sphere (From GLM_GTX_random extension)
			template <typename T> detail::tvec3<T> normalizedRand3(T Min, T Max){return normalizedRand3GTX(Min, Max);}                                                         //!< \brief Generate a scaled and normalized 3D vector regulary distribute on a sphere (From GLM_GTX_random extension)

	        template <typename T> inline T compRand1(){return compRand1GTX<T>();}                                                                                       //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension)
			template <> inline float compRand1(){return compRand1GTX<float>();}                                                                                         //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension)
	        template <> inline double compRand1(){return compRand1GTX<double>();}                                                                                       //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline T compRand1(T Min, T Max){return compRand1GTX(Min, Max);}                                                                      //!< \brief Generate a random number in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec2<T> compRand2(T Min, T Max){return compRand2GTX(Min, Max);}                                                              //!< \brief Generate 2 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec3<T> compRand3(T Min, T Max){return compRand3GTX(Min, Max);}                                                              //!< \brief Generate 3 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec4<T> compRand4(T Min, T Max){return compRand4GTX(Min, Max);}                                                              //!< \brief Generate 4 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        //template <int N, typename T> inline detail::_xvecxGTX<N, T> compRand(T Min, T Max){return compRand(Min, Max);}                                                      //!< \brief Generate N random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec2<T> compRand2(const detail::tvec2<T>& Min, const detail::tvec2<T>& Max){return compRand2GTX(Min, Max);}                                //!< \brief Generate 2 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec3<T> compRand3(const detail::tvec3<T>& Min, const detail::tvec3<T>& Max){return compRand3GTX(Min, Max);}                                //!< \brief Generate 3 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec3<T> compRand4(const detail::tvec4<T>& Min, const detail::tvec4<T>& Max){return compRand4GTX(Min, Max);}                                //!< \brief Generate 4 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)
	        //template <int N, typename T> inline detail::_xvecxGTX<N, T> compRand(const detail::_xvecxGTX<N, T>& Min, const detail::_xvecxGTX<N, T>& Max){return compRandGTX(Min, Max);}         //!< \brief Generate N random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension)

	        template <typename T> inline detail::tvec2<T> vecRand2(){return vecRand2GTX<T>();}                                                                                 //!< \brief Generate a random normalized 2 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec2<T> vecRand2(T MinRadius, T MaxRadius){return vecRand2GTX(MinRadius, MaxRadius);}                                        //!< \brief Generate a random normalized 2 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec3<T> vecRand3(){return vecRand3GTX<T>();}                                                                                 //!< \brief Generate a random normalized 3 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec3<T> vecRand3(T MinRadius, T MaxRadius){return vecRand3GTX(MinRadius, MaxRadius);}                                        //!< \brief Generate a random normalized 3 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec4<T> vecRand4(){return vecRand4GTX<T>();}                                                                                 //!< \brief Generate a random normalized 4 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)
	        template <typename T> inline detail::tvec4<T> vecRand4(T MinRadius, T MaxRadius){return vecRand4GTX(MinRadius, MaxRadius);}                                        //!< \brief Generate a random normalized 4 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension)

            template <typename T> inline T gaussRand1(T mean, T std_deviation){return gaussRand1GTX<T>(mean, std_deviation);}                                           //!< \brief Gererate a random floating number according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec2<T> gaussRand2(T mean, T std_deviation){return gaussRand2GTX<T>(mean, std_deviation);}                                   //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec3<T> gaussRand3(T mean, T std_deviation){return gaussRand3GTX<T>(mean, std_deviation);}                                   //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec4<T> gaussRand4(T mean, T std_deviation){return gaussRand4GTX<T>(mean, std_deviation);}                                   //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec2<T> gaussRand2(const detail::tvec2<T>& mean, T std_deviation){return gaussRand2GTX<T>(mean, std_deviation);}                    //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec3<T> gaussRand3(const detail::tvec3<T>& mean, T std_deviation){return gaussRand3GTX<T>(mean, std_deviation);}                    //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec4<T> gaussRand4(const detail::tvec4<T>& mean, T std_deviation){return gaussRand4GTX<T>(mean, std_deviation);}                    //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec2<T> gaussRand2(T  mean, const detail::tvec2<T>& std_deviation){return gaussRand2GTX<T>(mean, std_deviation);}                   //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec3<T> gaussRand3(T  mean, const detail::tvec3<T>& std_deviation){return gaussRand3GTX<T>(mean, std_deviation);}                   //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec4<T> gaussRand4(T  mean, const detail::tvec4<T>& std_deviation){return gaussRand4GTX<T>(mean, std_deviation);}                   //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec2<T> gaussRand2(const detail::tvec2<T>& mean, const detail::tvec2<T>& std_deviation){return gaussRand2GTX<T>(mean, std_deviation);}     //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec3<T> gaussRand3(const detail::tvec3<T>& mean, const detail::tvec3<T>& std_deviation){return gaussRand3GTX<T>(mean, std_deviation);}     //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
            template <typename T> inline detail::tvec4<T> gaussRand4(const detail::tvec4<T>& mean, const detail::tvec4<T>& std_deviation){return gaussRand4GTX<T>(mean, std_deviation);}     //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension)
		}
	}
}

#define GLM_GTX_random namespace gtx::random

#include "random.inl"

#endif//glm_gtx_random
