#include "PDG_ProcessorRandom.h"
{
port->value(1)->setValue(10);
port->setDisableCondition("{ setattrib == 0 }");
"workitemrandomize", "Work Item Randomize", "Processors", processor);
}
using namespace HDK_Sample;
{
}
PDG_ProcessorRandom::onGenerate(
GenerationType generate_type)
{
uint seed = evaluateI(
"seed");
if (!upstream_items.
size())
{
if (!_generate(nullptr, item_holder, seed))
}
else
{
for (auto&& upstream_item : upstream_items)
{
seed += upstream_item->index();
if (!_generate(upstream_item, item_holder, seed))
}
}
}
bool
PDG_ProcessorRandom::_generate(
{
exint min = evaluateI(
"range", parent, 0);
exint max = evaluateI(
"range", parent, 1);
exint num = SYSrandom(seed)*(max-
min) + min;
for (int i = 0; i < num; i++)
{
result, options, errors);
if (!new_item)
{
return false;
}
if (!evaluateB("setattrib", new_item))
continue;
attrib_name, i, 0, true);
}
return true;
}