Overview
C API (Component Interface)
struct EventGetRandomSeed { UINT32 flags; UINT32* seed; UINT32 count; };

Get a random seed for use by the calling Component.

Notes
  • Two calling protocols are used, listed below. The two call protocol is needed if the component wishes to use exactly the seed that was specified in the SystemML document. If the component would rather have a seed of a fixed length and is happy to let the framework grow this from the seed specified in the SystemML document, only the second call is required.

Contract Wrappers

1199
getRandomSeed()

First Call

Fields

UINT32 flags IN
None defined (must be zero).
UINT32* seed IN
Must be NULL.
UINT32 count IN
Must be zero.

Return Values

See also General Interface Return Values.

Result

  • count is set to the length of seed available in the SystemML document for this component, or zero to indicate that a seed of indefinite length is available.

Second Call

Fields

UINT32 flags IN
None defined (must be zero).
UINT32* seed IN
Points to a storage buffer having space for at least count elements (UINT32 elements).
UINT32 count IN
Number of seed elements which are required.

Return Values

See also General Interface Return Values.

Result

  • The buffer pointed to by seed is filled with count seed elements. If more elements were requested than were available, the returned seed is padded with 0xAAAAAAAA.

Example

Taken from 1199.

C Source Code (against Component Interface)
VUINT32 getRandomSeed(UINT32 count = 0) { VUINT32 seed; EventGetRandomSeed rseed; rseed.flags = 0; rseed.count = count; Symbol result = S_NULL; if (count) { seed.resize(count); rseed.seed = &seed[0]; EngineEvent event; event.hCaller = hComponent; event.flags = 0; event.type = ENGINE_EVENT_GET_RANDOM_SEED; event.data = (void*) &rseed; result = brahms_engineEvent(&event); if (S_ERROR(result)) throw result; } else { rseed.seed = NULL; EngineEvent event; event.hCaller = hComponent; event.flags = 0; event.type = ENGINE_EVENT_GET_RANDOM_SEED; event.data = (void*) &rseed; result = brahms_engineEvent(&event); if (S_ERROR(result)) throw result; seed.resize(rseed.count); rseed.seed = &seed[0]; result = brahms_engineEvent(&event); if (S_ERROR(result)) throw result; } return seed; }