pwxlib
0.8.9
Tools Library for C++ Development
|
Static class to produce unique or pseudo random numbers, hashes and names. More...
#include <pwxCRandom.h>
Public Types | |
typedef std::mutex | lock_t |
Use standard mutex if no spinlocks are used. | |
Public Member Functions | |
CRandom () noexcept | |
default ctor More... | |
CRandom (const CRandom &) PWX_DELETE | |
~CRandom () noexcept | |
default dtor More... | |
int32_t | getSeed () const noexcept |
return current seed More... | |
uint32_t | hash (int16_t key) const noexcept |
hash an unsigned 16 bit integer to an unsigned 32 bit integer More... | |
uint32_t | hash (uint16_t key) const noexcept |
hash a signed 16 bit integer to an unsigned 32 bit integer More... | |
uint32_t | hash (int32_t key) const noexcept |
hash a signed 32 bit integer to an unsigned 32 bit integer More... | |
uint32_t | hash (uint32_t key) const noexcept |
hash an unsigned 32 bit integer to an unsigned 32 bit integer More... | |
uint32_t | hash (int64_t key) const noexcept |
hash a signed 64 bit integer to an unsigned 32 bit integer More... | |
uint32_t | hash (uint64_t key) const noexcept |
hash an unsigned 64 bit integer to an unsigned 32 bit integer More... | |
uint32_t | hash (float key) const noexcept |
hash float to an unsigned 32 bit integer More... | |
uint32_t | hash (double key) const noexcept |
hash double to an unsigned 32 bit integer More... | |
uint32_t | hash (long double key) const noexcept |
hash long double to an unsigned 32 bit integer More... | |
uint32_t | hash (const char *key, size_t keyLen=0) const noexcept |
hash C-String to an unsigned 32 bit integer More... | |
uint32_t | hash (std::string &key) const noexcept |
hash an std::string to an unsigned 32 bit integer More... | |
eNameSourceType | nextNST (void) noexcept |
Switches to the next [N]ame[S]ource[T]ype and returns that. More... | |
double | noise (int32_t x) const noexcept |
noise with one dimension More... | |
double | noise (int32_t x, int32_t y) const noexcept |
noise with two dimensions More... | |
double | noise (int32_t x, int32_t y, int32_t z) const noexcept |
noise with three dimensions More... | |
double | noise (int32_t x, int32_t y, int32_t z, int32_t w) const noexcept |
noise with four dimensions More... | |
eNameSourceType | prevNST (void) noexcept |
Switches to the previous [N]ame[S]ource[T]ype and returns that. More... | |
int16_t | random (int16_t max) noexcept |
Generate a random value of int16_t between 0 and max. More... | |
int16_t | random (int16_t min, int16_t max) noexcept |
Generate a random value of int16_t between min and max. More... | |
uint16_t | random (uint16_t max) noexcept |
Generate a random value of uint16_t between 0 and max. More... | |
uint16_t | random (uint16_t min, uint16_t max) noexcept |
Generate a random value of uint16_t between min and max. More... | |
int32_t | random (int32_t max=RAND_MAX) noexcept |
Generate a random value of int32_t between 0 and max. More... | |
int32_t | random (int32_t min, int32_t max) noexcept |
Generate a random value of int32_t between min and max. More... | |
uint32_t | random (uint32_t max=RAND_MAX) noexcept |
Generate a random value of uint32_t between 0 and max. More... | |
uint32_t | random (uint32_t min, uint32_t max) noexcept |
Generate a random value of uint32_t between min and max. More... | |
int64_t | random (int64_t max) noexcept |
Generate a random value of int64_t between 0 and max. More... | |
int64_t | random (int64_t min, int64_t max) noexcept |
Generate a random value of int64_t between min and max. More... | |
uint64_t | random (uint64_t max) noexcept |
Generate a random value of uint64_t between 0 and max. More... | |
uint64_t | random (uint64_t min, uint64_t max) noexcept |
Generate a random value of uint64_t between min and max. More... | |
float | random (float max) noexcept |
Generate a random value of float between 0 and max. More... | |
float | random (float min, float max) noexcept |
Generate a random value of float between min and max. More... | |
double | random (double max) noexcept |
Generate a random value of double between 0 and max. More... | |
double | random (double min, double max) noexcept |
Generate a random value of double between min and max. More... | |
long double | random (long double max) noexcept |
Generate a random value of long double between 0 and max. More... | |
long double | random (long double min, long double max) noexcept |
Generate a random value of long double between min and max. More... | |
size_t | random (char *dest, size_t minLen, size_t maxLen) noexcept |
Generates a random C-String with minLen to maxLen characters. More... | |
char * | rndName (double x, bool lN=false, bool mW=false) noexcept |
get random name (1D) More... | |
char * | rndName (double x, double y, bool lN=false, bool mW=false) noexcept |
get random name (2D) More... | |
char * | rndName (double x, double y, double z, bool lN=false, bool mW=false) noexcept |
get random name (3D) More... | |
char * | rndName (double x, double y, double z, double w, bool lN=false, bool mW=false) noexcept |
get random name (4D) More... | |
char * | rndName (double x, int32_t chars, int32_t sylls, int32_t parts) noexcept |
get random name (1D) More... | |
char * | rndName (double x, double y, int32_t chars, int32_t sylls, int32_t parts) noexcept |
get random name (2D) More... | |
char * | rndName (double x, double y, double z, int32_t chars, int32_t sylls, int32_t parts) noexcept |
get random name (3D) More... | |
char * | rndName (double x, double y, double z, double w, int32_t chars, int32_t sylls, int32_t parts) noexcept |
get random name More... | |
void | setNST (eNameSourceType type) noexcept |
set name source type to type More... | |
void | setSeed (int32_t newSeed) noexcept |
set Simplex Seed More... | |
double | simplex1D (double x, double zoom=1.0, double smooth=1.0) noexcept |
calculate a one dimensional simplex noise value More... | |
double | simplex1D (double x, double zoom, double smooth, double reduction, int32_t waves) noexcept |
calculate a one dimensional simplex wave More... | |
double | simplex2D (double x, double y, double zoom=1.0, double smooth=1.0) noexcept |
calculate a two dimensional simplex noise value More... | |
double | simplex2D (double x, double y, double zoom, double smooth, double reduction, int32_t waves) noexcept |
calculate a two dimensional simplex wave More... | |
double | simplex3D (double x, double y, double z, double zoom=1.0, double smooth=1.0) noexcept |
calculate a three dimensional simplex noise value More... | |
double | simplex3D (double x, double y, double z, double zoom, double smooth, double reduction, int32_t waves) noexcept |
calculate a three dimensional simplex wave More... | |
double | simplex4D (double x, double y, double z, double w, double zoom=1.0, double smooth=1.0) noexcept |
calculate a four dimensional simplex noise value More... | |
double | simplex4D (double x, double y, double z, double w, double zoom, double smooth, double reduction, int32_t waves) noexcept |
calculate a four dimensional simplex wave More... | |
CRandom & | operator= (const CRandom &) PWX_DELETE |
bool | beThreadSafe () const noexcept |
true if thread safety is turned on More... | |
void | beThreadSafe (bool doLock) noexcept |
set thread safety to doLock More... | |
bool | clear_locks () noexcept |
remove all locks More... | |
bool | destroyed () const noexcept |
if true the object will no longer lock More... | |
void | do_locking (bool doLock) noexcept |
set thread safety to doLock More... | |
bool | is_locked () const noexcept |
return true if this object is locked More... | |
bool | is_locking () const noexcept |
true if thread safety is turned on More... | |
void | lock () noexcept |
lock this object More... | |
uint32_t | lock_count () const noexcept |
number of locks this thread holds on this object More... | |
bool | try_lock () noexcept |
try to lock and return at once More... | |
void | unlock () noexcept |
unlock this object More... | |
Protected Attributes | |
abool_t | isDestroyed = ATOMIC_VAR_INIT(false) |
Should be set to true by the destructors of deriving classes. | |
mord_t | memOrdLoad = PWX_MEMORDER_ACQUIRE |
to be used with atomic::load() | |
mord_t | memOrdStore = PWX_MEMORDER_RELEASE |
to be used with atomic::store() | |
Static class to produce unique or pseudo random numbers, hashes and names.
This class produces a static instance called pwx::RNG, meaning "Random Name/Noise/Number Generator".
The following sets of functions are available:
|
explicitnoexcept |
default ctor
Initializes the random number generator and assigns a first random value to lastRndValue. The seed and Simplex data are initialized as well.
|
noexcept |
default dtor
Empty default dtor, nothing to be done.
|
noexceptinherited |
true if thread safety is turned on
return true if thread safety mode is turned on
Referenced by pwx::private_::CThreadElementStore::clear(), pwx::private_::CThreadElementStore::curr(), pwx::private_::CThreadElementStore::disable_thread_safety(), pwx::VTHashBase< key_t, data_t, THashElement< key_t, data_t > >::disable_thread_safety(), pwx::private_::CThreadElementStore::enable_thread_safety(), pwx::VTHashBase< key_t, data_t, THashElement< key_t, data_t > >::enable_thread_safety(), pwx::VTHashBase< key_t, data_t, THashElement< key_t, data_t > >::operator+=(), and pwx::VTHashBase< key_t, data_t, THashElement< key_t, data_t > >::operator=().
|
noexceptinherited |
set thread safety to doLock
set thread safety mode to doLock This is just an alias for do_locking().
|
noexceptinherited |
remove all locks
clear all locks from this thread.
If this thread is the current owner of the lock, and if there are locks in place, they are all cleared.
If this thread is not the owner, the method simply returns false.
References CURRENT_THREAD_ID.
|
noexceptinherited |
if true the object will no longer lock
returns true if the data was destroyed
The destructor of TSingleElement and TDoubleElement will try to get a final lock on the element when it is destroyed. If another thread acquires a lock between the data destruction and this final dtor lock, destroyed() will return "true".
References pwx::CLockable::isDestroyed, and pwx::CLockable::memOrdLoad.
Referenced by pwx::TSingleElement< data_t >::insertBefore(), pwx::THashElement< size_t, curr_t >::insertNext(), pwx::TDoubleElement< data_t >::insertNext(), pwx::TSingleElement< data_t >::insertNext(), and pwx::TDoubleElement< data_t >::insertPrev().
|
noexceptinherited |
set thread safety to doLock
switch whether to really use locking or not.
With this method you can switch the locking mechanics on/off for objects to be used in concurrency or strictly single threaded. The default is to turn locking on.
[in] | doLock | true to turn locking on, false to turn it off. |
References CURRENT_THREAD_ID.
Referenced by pwx::VElement::disable_thread_safety(), and pwx::VElement::enable_thread_safety().
|
noexcept |
return current seed
This method simply returns the current Seed used to manipulate values to calculate Simplex Noise and random names.
|
noexcept |
hash an unsigned 16 bit integer to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash a signed 16 bit integer to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash a signed 32 bit integer to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash an unsigned 32 bit integer to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash a signed 64 bit integer to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash an unsigned 64 bit integer to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash float to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash double to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash long double to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexcept |
hash C-String to an unsigned 32 bit integer
[in] | key | The key to hash |
[in] | keyLen | if omitted, a 0-terminated C-String is assumed |
|
noexcept |
hash an std::string to an unsigned 32 bit integer
[in] | key | The key to hash |
|
noexceptinherited |
return true if this object is locked
return true if this object is currently locked
References pwx::CLockable::memOrdLoad.
|
noexceptinherited |
true if thread safety is turned on
return true if the locking is turned on.
|
noexceptinherited |
lock this object
lock
Lock this object for the current thread if locking is enabled.
References CURRENT_THREAD_ID, pwx::CLockable::isDestroyed, and pwx::CLockable::memOrdLoad.
Referenced by pwx::private_::CThreadElementStore::curr().
|
noexceptinherited |
number of locks this thread holds on this object
return the number of locks on this object this thread has
References CURRENT_THREAD_ID.
|
noexcept |
Switches to the next [N]ame[S]ource[T]ype and returns that.
|
noexcept |
noise with one dimension
This method calculates a noise value between -1.0 and 1.0 out of one integer
[in] | x | paramter to transform |
|
noexcept |
noise with two dimensions
This method calculates a noise value between -1.0 and 1.0 out of two integers
[in] | x | paramter to transform |
[in] | y | paramter to transform |
References pwx::constants::fullMaxInt.
|
noexcept |
noise with three dimensions
This method calculates a noise value between -1.0 and 1.0 out of three integers
[in] | x | paramter to transform |
[in] | y | paramter to transform |
[in] | z | paramter to transform |
References pwx::constants::fullMaxInt.
|
noexcept |
noise with four dimensions
This method calculates a noise value between -1.0 and 1.0 out of four integers
[in] | x | paramter to transform |
[in] | y | paramter to transform |
[in] | z | paramter to transform |
[in] | w | paramter to transform |
|
noexcept |
Switches to the previous [N]ame[S]ource[T]ype and returns that.
|
noexcept |
Generate a random value of int16_t between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of int16_t between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of uint16_t between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of uint16_t between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of int32_t between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of int32_t between min and max.
if max is lower than min, the result will be max <= result <= min.
This method has a default value of RAND_MAX for max.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of uint32_t between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
This method has a default value of RAND_MAX for max.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of uint32_t between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of int64_t between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of int64_t between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of uint64_t between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of uint64_t between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of float between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of float between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of double between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of double between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of long double between 0 and max.
if a negative max is submitted, the result will be max <= result <= 0.
[in] | max | Maximum result. |
|
noexcept |
Generate a random value of long double between min and max.
if max is lower than min, the result will be max <= result <= min.
[in] | min | Minimum result. |
[in] | max | Maximum result. |
|
noexcept |
Generates a random C-String with minLen to maxLen characters.
The characters are in the range of a-z and A-Z. No whitespace or special characters are used.
Note: dest is not checked. It must have a size of at least maxLen + 1 zero-byte. This means, that if both values are 0, nothing is done with dest, and if the larger value is 1, dest will simply made to start with a zero-byte.
[out] | dest | the char buffer the random character sequence is written into. |
[in] | minLen | minimum length of the random character sequence. |
[out] | maxLen | maximum length of the random character sequence. |
|
noexcept |
get random name (1D)
This is a convenient wrapper for getting a random name out of one dimension and switches for long name and multi part.
lN decides upon the maximum number of chars and syllables generated. A value of false (the default) results in a maximum of 12 chars in four syllables. Setting this argument to true results in a maximum of 20 chars in up to six syllables.
mW decides upon the maximum number of parts. A value of false (the default) produces a name out of one part. A value of true results in a name that can be generated out of up to three parts.
[in] | x | simple number to influence the result. |
[in] | lN | longName - sets syllables to 3-8 and max chars to 28 |
[in] | mW | multiWord - allows the name to contain spaces (0-2) |
|
noexcept |
get random name (2D)
This is a convenient wrapper for getting a random name out of two dimensions and switches for long name and multi part.
lN decides upon the maximum number of chars and syllables generated. A value of false (the default) results in a maximum of 12 chars in four syllables. Setting this argument to true results in a maximum of 20 chars in up to six syllables.
mW decides upon the maximum number of parts. A value of false (the default) produces a name out of one part. A value of true results in a name that can be generated out of up to three parts.
[in] | x | simple number to influence the result. |
[in] | y | simple number to influence the result. |
[in] | lN | longName - sets syllables to 3-8 and max chars to 28 |
[in] | mW | multiWord - allows the name to contain spaces (0-2) |
|
noexcept |
get random name (3D)
This is a convenient wrapper for getting a random name out of three dimensions and switches for long name and multi part.
lN decides upon the maximum number of chars and syllables generated. A value of false (the default) results in a maximum of 12 chars in four syllables. Setting this argument to true results in a maximum of 20 chars in up to six syllables.
mW decides upon the maximum number of parts. A value of false (the default) produces a name out of one part. A value of true results in a name that can be generated out of up to three parts.
[in] | x | simple number to influence the result. |
[in] | y | simple number to influence the result. |
[in] | z | simple number to influence the result. |
[in] | lN | longName - sets syllables to 3-8 and max chars to 28 |
[in] | mW | multiWord - allows the name to contain spaces (0-2) |
|
noexcept |
get random name (4D)
This is a convenient wrapper for getting a random name out of four dimensions and switches for long name and multi part.
lN decides upon the maximum number of chars and syllables generated. A value of false (the default) results in a maximum of 12 chars in four syllables. Setting this argument to true results in a maximum of 20 chars in up to six syllables.
mW decides upon the maximum number of parts. A value of false (the default) produces a name out of one part. A value of true results in a name that can be generated out of up to three parts.
[in] | x | simple number to influence the result. |
[in] | y | simple number to influence the result. |
[in] | z | simple number to influence the result. |
[in] | w | simple number to influence the result. |
[in] | lN | longName - sets syllables to 3-8 and max chars to 28 |
[in] | mW | multiWord - allows the name to contain spaces (0-2) |
|
noexcept |
get random name (1D)
This is a convenient wrapper for getting a random name out of one dimension.
[in] | x | simple number to influence the result. |
[in] | chars | set the maximum number of characters to be generated |
[in] | sylls | set the maximum number of syllables to be generated |
[in] | parts | set the maximum number of parts the resulting name consists of |
|
noexcept |
get random name (2D)
This is a convenient wrapper for getting a random name out of two dimensions.
[in] | x | simple number to influence the result. |
[in] | y | simple number to influence the result. |
[in] | chars | set the maximum number of characters to be generated |
[in] | sylls | set the maximum number of syllables to be generated |
[in] | parts | set the maximum number of parts the resulting name consists of |
|
noexcept |
get random name (3D)
This is a convenient wrapper for getting a random name out of three dimensions.
[in] | x | simple number to influence the result. |
[in] | y | simple number to influence the result. |
[in] | z | simple number to influence the result. |
[in] | chars | set the maximum number of characters to be generated |
[in] | sylls | set the maximum number of syllables to be generated |
[in] | parts | set the maximum number of parts the resulting name consists of |
|
noexcept |
get random name
This method produces random names by combining letters into syllables and syllables into words. This strictly depends on pseudo random generators, utilizing noise() and simplex() methods. Therefore you get the same result if called twice with the same seed set and arguments set.
The main switch for the name generation is parts, which must be at least one. Each parts consits of at least two syllables. Therefore, if you set sylls to a lower value than parts + 1, sylls will be raised automatically. Furthermore each syllable consist of two to four chars. Thus if you set chars to a lower value than (sylls * 3) + 2, it will be raised, too. In the end chars will be at least: 3 * (1 + parts) + 2.
You can use one of the convenient wrapper which let you decide whether you want long or short names, consisting of one or up to three parts.
[in] | x | simple number to influence the result. |
[in] | y | simple number to influence the result. |
[in] | z | simple number to influence the result. |
[in] | w | simple number to influence the result. |
[in] | chars | set the maximum number of characters to be generated |
[in] | sylls | set the maximum number of syllables to be generated |
[in] | parts | set the maximum number of parts the resulting name consists of |
1) Determine whether the next syllable ends a part, genSyllable() needs to know.
2) generate syllable:
3) if we have a syllable (genSyllable produces an empty string on error) it can be added:
|
noexcept |
set name source type to type
[in] | type | the new name source type |
|
noexcept |
set Simplex Seed
Set the seed to newSeed which will cause the simplex table to be reinitialized.
|
noexcept |
calculate a one dimensional simplex noise value
This method returns a simplex noise value of one dimension.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
|
noexcept |
calculate a one dimensional simplex wave
This method returns a simplex wave of one dimension. The number of waves specified will overlay each others with multiplied smoothing, specified by 'reduction'. The default value of 1 wave just returns the simplex noise value in an intervall of [-1, 1]. While having more than one waves makes it possible to stay in this intervall, the results will most probably be nearer to zero.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
[in] | reduction | Multiplier for the smoothing factor in each round. |
[in] | waves | Number of waves to overlay. The default of 1 returns the pure Simplex Noise Value. |
|
noexcept |
calculate a two dimensional simplex noise value
This method returns a simplex noise value of two dimensions.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | y | Y-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
|
noexcept |
calculate a two dimensional simplex wave
This method returns a simplex wave of two dimensions. The number of waves specified will overlay each others with multiplied smoothing, specified by 'reduction'. The default value of 1 wave just returns the simplex noise value in an intervall of [-1, 1]. While having more than one waves makes it possible to stay in this intervall, the results will most probably be nearer to zero.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | y | Y-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
[in] | reduction | Multiplier for the smoothing factor in each round. |
[in] | waves | Number of waves to overlay. The default of 1 returns the pure Simplex Noise Value. |
|
noexcept |
calculate a three dimensional simplex noise value
This method returns a simplex wave of three dimensions.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | y | Y-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | z | Z-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
|
noexcept |
calculate a three dimensional simplex wave
This method returns a simplex wave of three dimensions. The number of waves specified will overlay each others with reduced zoom, specified by 'reduction'. The default value of 1 wave just returns the simplex noise value in an intervall of [-1, 1]. While having more than one waves makes it possible to stay in this intervall, the results will most probably be nearer to zero.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | y | Y-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | z | Z-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
[in] | reduction | Multiplier for the smoothing factor in each round. |
[in] | waves | Number of waves to overlay. The default of 1 returns the pure Simplex Noise Value. |
|
noexcept |
calculate a four dimensional simplex noise value
This method returns a simplex noise value of four dimension.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | y | Y-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | z | Z-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | w | W-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
|
noexcept |
calculate a four dimensional simplex wave
This method returns a simplex wave of four dimension. The number of waves specified will overlay each others with reduced zoom, specified by 'reduction'. The default value of 1 wave just returns the simplex noise value in an intervall of [-1, 1]. While having more than one waves makes it possible to stay in this intervall, the results will most probably be nearer to zero.
[in] | x | X-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | y | Y-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | z | Z-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | w | W-Coordinate of the Simplex Point, modified by the simplex seed. |
[in] | zoom | Zooming factor into the point. Your coordinate will divided by this factor. |
[in] | smooth | Divisor for the result. The higher, the nearer the result will be to zero. |
[in] | reduction | Multiplier for the smoothing factor in each round. |
[in] | waves | Number of waves to overlay. The default of 1 returns the pure Simplex Noise Value. |
|
noexceptinherited |
try to lock and return at once
try_lock
Try to lock this object.
References CURRENT_THREAD_ID, pwx::CLockable::isDestroyed, and pwx::CLockable::memOrdLoad.
Referenced by pwx::try_locks().
|
noexceptinherited |
unlock this object
unlock
If locking is disabled or if the current thread does not hold the lock, nothing happens. Otherwise the last lock is released.
References CURRENT_THREAD_ID.
Referenced by pwx::private_::CThreadElementStore::curr(), pwx::try_locks(), and pwx::unlock_all().