/// <summary> /// Generates a random node type based on a distribution computed from current frequencies. /// </summary> /// <param name="c"></param> /// <returns></returns> public virtual NodeType getRandomNodeType(NodeClass c, NodeType?parrentType, NodeCreationConstrains constrains = null) { if (parrentType == null || !relativizedProfiles.ContainsKey(parrentType.Value)) { return(simpleProfile.getRandomNodeType(c, constrains)); } return(relativizedProfiles[parrentType.Value].getRandomNodeType(c, constrains)); }
/// <summary> /// Creates a new fully initialized node whose type is selected randomly based on distribution in given NodeTypeFrequencyProfile object. Node that require value to be set (like numeric constants) will receive a random number between 0 and 10 as their value. /// If the node requires successors to be specified, such successors will be created and default-value-node will be used. /// </summary> /// <param name="cl"></param> /// <param name="profile"></param> /// <returns></returns> public static Node createRandomNode(NodeClass cl, NodeTypeFrequencyProfile profile, NodeCreationConstrains constrains = null) { NodeType t = profile.getRandomNodeType(cl, constrains); return(createRandomNode(t, constrains)); }