This commit is contained in:
2025-12-07 04:36:22 +05:30
parent 0476ed2392
commit 09575d6119
3 changed files with 15 additions and 0 deletions

View File

@ -52,6 +52,11 @@ namespace IACore
return std::chrono::duration_cast<std::chrono::seconds>(HighResClock::now() - g_startTime).count(); return std::chrono::duration_cast<std::chrono::seconds>(HighResClock::now() - g_startTime).count();
} }
FLOAT32 GetRandom()
{
return static_cast<FLOAT32>(rand()) / static_cast<FLOAT32>(RAND_MAX);
}
UINT32 GetRandom(IN UINT32 seed) UINT32 GetRandom(IN UINT32 seed)
{ {
srand(seed); srand(seed);

View File

@ -360,10 +360,19 @@ namespace IACore
[sid](IN StringView line) { [sid](IN StringView line) {
UNUSED(sid); UNUSED(sid);
UNUSED(line); UNUSED(line);
#if __IA_DEBUG
puts(std::format(__CC_MAGENTA "[Node:{}:STDOUT|STDERR]: {}" __CC_DEFAULT, sid, line).c_str());
#endif
}, },
[sid](IN Expected<INT32, String> result) { [sid](IN Expected<INT32, String> result) {
UNUSED(sid); UNUSED(sid);
UNUSED(result); UNUSED(result);
#if __IA_DEBUG
if (!result)
puts(std::format(__CC_RED "Failed to spawn Node: {} with error '{}'" __CC_DEFAULT, sid, result.error()).c_str());
else
puts(std::format(__CC_RED "[Node: {}]: Exited with code {}" __CC_DEFAULT, sid, *result).c_str());
#endif
}); });
// Give some time for child node to stablize // Give some time for child node to stablize

View File

@ -31,6 +31,7 @@ namespace IACore
UINT64 GetTicksCount(); UINT64 GetTicksCount();
FLOAT64 GetSecondsCount(); FLOAT64 GetSecondsCount();
FLOAT32 GetRandom();
UINT32 GetRandom(IN UINT32 seed); UINT32 GetRandom(IN UINT32 seed);
INT64 GetRandom(IN INT64 min, IN INT64 max); INT64 GetRandom(IN INT64 min, IN INT64 max);