- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FMath/FMRandom.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00014 #ifndef _FM_RANDOM_H_
    00015 #define _FM_RANDOM_H_
    00016
    00018 namespace FMRandom
    00019 {
    00022     FCOLLADA_EXPORT void Seed(uint32 seed);
    00023
    00027     FCOLLADA_EXPORT uint32 GetUInt32();
    00028
    00033     inline uint32 GetUInt32(uint32 rangeEnd) { return GetUInt32() % rangeEnd; }
    00034
    00040     inline uint32 GetUInt32(uint32 rangeStart, uint32 rangeEnd) { return (GetUInt32() % (rangeEnd - rangeStart)) + rangeStart; }
    00041
    00045     inline bool GetBoolean() { return (bool) (GetUInt32() & 0x1); }
    00046
    00050     FCOLLADA_EXPORT int32 GetInt32();
    00051
    00057     inline int32 GetInt32(int32 rangeStart, int32 rangeEnd) { return (((int32) GetUInt32()) % (rangeEnd - rangeStart)) + rangeStart; }
    00058
    00062     FCOLLADA_EXPORT float GetFloat();
    00063
    00068     inline float GetFloat(float rangeEnd) { return GetFloat() * rangeEnd; }
    00069
    00075     inline float GetFloat(float rangeStart, float rangeEnd) { return GetFloat() * (rangeEnd - rangeStart) + rangeStart; }
    00076 };
    00077
    00078 #endif // _FM_RANDOM_H_
    00079