Random Classes

内容表

关于

The MAXON API provides pseudo random number generators for trivial purposes and cryptographic applications.

Random

maxon::LinearCongruentialRandom is a standard pseudo random number generator that can be initialized with a seed value:

// This example fills an array with pseudo random numbers float values.

// prepare array maxon::BaseArray<maxon::Float32> values; 值。 EnsureCapacity (count) iferr_return ;

// init pseudo random generator maxon::LinearCongruentialRandom<maxon::Float32> random; random. Init (123);

// fill array with random float values for ( maxon::Int32 i = 0; i < count; ++i) { const maxon::Float32 randomValue = random. Get01 (); 值。 Append (randomValue) iferr_return ; }

SecureRandom

maxon::SecureRandom is a cryptographically secure pseudo-random number generator. It is typically used in the context of encrypting data. See Cryptography

maxon::SecureRandom provides these static functions:

// This example fills an array with cryptographically secure random data.

// prepare array maxon::BaseArray<maxon::UChar> values; 值。 Resize (100) iferr_return ;

// fill array with random data const maxon::SecureRandomProvider provider = maxon::SecureRandom::GetDefaultProvider (); maxon::SecureRandom::GetRandomNumber (provider, values);

// print random data for ( maxon::UChar & chr : values) { DiagnosticOutput ( "Random Data: @" , chr); }

延伸阅读

maxon::SecureRandom::GetDefaultProvider
static MAXON_METHOD SecureRandomProvider GetDefaultProvider()
maxon::Float32
float Float32
32 bit floating point value (float)
定义: apibase.h:178
maxon::BaseArray::Resize
ResultMem Resize(Int newCnt, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::DEFAULT)
定义: basearray.h:1077
iferr_return
#define iferr_return
定义: resultbase.h:1434
maxon::BaseArray
定义: basearray.h:366
DiagnosticOutput
#define DiagnosticOutput(formatString,...)
定义: debugdiagnostics.h:166
maxon::BaseArray::Append
MAXON_ATTRIBUTE_FORCE_INLINE ResultRef< T > Append()
定义: basearray.h:569
maxon::Int32
int32_t Int32
32 bit signed integer datatype.
定义: apibase.h:172
maxon::SecureRandom::GetRandomNumber
static MAXON_METHOD Bool GetRandomNumber(SecureRandomProvider provider, const Block< Byte > &buffer)
maxon::LinearCongruentialRandom
定义: lib_math.h:18
maxon::LinearCongruentialRandom::Init
void Init(UInt32 seed)
maxon::UChar
unsigned char UChar
unsigned 8 bit character
定义: apibase.h:181
maxon::LinearCongruentialRandom::Get01
FLOAT Get01()
Returns the next random value in the range of [0..1].
maxon::BaseArray::EnsureCapacity
ResultMem EnsureCapacity(Int requestedCapacity, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY)
定义: basearray.h:1188
maxon::BaseRef
定义: apibase.h:1522

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1