Skip to content

← random package

SplitRandomSeed

Manually split a random seed into an array of multiple derived seeds.

The resulting array is of size (num,N) where N is implementation specific and depends on the type of seed. One way this can be used is to split off a key for each successive random operation one wants to perform, where one generates two keys from the initial seed -- one as the next seed (for future splitting) and one as the key for the current operation. The other way is to pre-generate a number of keys for use in multiple operations. The schemes can also be mixed, where one splits as many keys as needed to pass into various functions, and each function further splits keys to drive its random operations. The initial seed must have been generated using the Create Random Seed node. This node outputs the split key as an array of size (num,N) under the output key. However, for convenience, it also provides outputs named main_key and subkey1, subkey2, etc. which correspond to the zero'th and first through num'th elements of the key array, each of which represents a single key. Note there is technically no distinction between a "main" key and "sub"keys, but the naming suggests the use of the main key for subsequent splitting within the same function, and the subkey(s) for passing down into some random operation(s). Version 0.5.0

Ports/Properties

key

Splittable random seed.

verbose name
Key
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
INOUT

main_key

Updated main key.

verbose name
Main Key
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey1

Subkey 1.

verbose name
Subkey1
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey2

Subkey 2.

verbose name
Subkey2
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey3

Subkey 3.

verbose name
Subkey3
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey4

Subkey 4.

verbose name
Subkey4
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey5

Subkey 5.

verbose name
Subkey5
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey6

Subkey 6.

verbose name
Subkey6
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey7

Subkey 7.

verbose name
Subkey7
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey8

Subkey 8.

verbose name
Subkey8
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

subkey9

Subkey 9.

verbose name
Subkey9
default value
None
port type
DataPort
value type
AnyArray (can be None)
data direction
OUT

num

Number of random seeds to generate.

verbose name
Num
default value
2
port type
IntPort
value type
int (can be None)

algorithm

Random number generation algorithm for which to generate a seed. The default depends on the chosen backend, and not all backends support all algorithms. For this reason it is recommended to use the default.

verbose name
Algorithm
default value
keep
port type
EnumPort
value type
str (can be None)

backend

Optional compute backend for which to generate the seed. Keep is the current default, which is typically numpy, but which can be overridden in contexts that require it. Some backends (notably jax and tensorflow) require that the seed be generated using the same backend as the downstream random operation. For this reason, it is a good idea to use the same backend for both the seed management and the random operation to future-proof one's pipeline.

verbose name
Backend
default value
keep
port type
EnumPort
value type
str (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)