MCPcopy Create free account
hub / github.com/devosoft/avida / GetRandomInst

Method GetRandomInst

avida-core/source/cpu/cInstSet.cc:83–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83Instruction cInstSet::GetRandomInst(cAvidaContext& ctx) const
84{
85 double weight = ctx.GetRandom().GetDouble(m_mutation_index->GetTotalWeight());
86 unsigned inst_ndx = m_mutation_index->FindPosition(weight);
87 return Instruction(inst_ndx);
88}
89
90
91

Callers 15

ProcessMethod · 0.80
ProcessMethod · 0.80
Inst_HeadReadMethod · 0.80
Inst_HeadWriteMethod · 0.80
Inst_HeadCopyMethod · 0.80
Inst_ReproMethod · 0.80
Allocate_RandomMethod · 0.80
Inst_CopyMethod · 0.80
Inst_WriteInstMethod · 0.80
Inst_StackWriteInstMethod · 0.80
Inst_CompareMethod · 0.80
Inst_ReproMethod · 0.80

Calls 4

InstructionClass · 0.50
GetDoubleMethod · 0.45
GetTotalWeightMethod · 0.45
FindPositionMethod · 0.45

Tested by 1

TestPairsMethod · 0.64