void generate_stylesheet_instance(random_gen& x, ostream& out, int min_len, int max_len) { out << "1011\n"; out << "3\n"; x.random_string(out, 15, 15); // name x.random_string(out, min_len, max_len); // sheet1 x.random_string(out, min_len, max_len); // sheet2 }
void generate_graphic_instance(info_base* b_ptr, random_gen& x, ostream& out, int min_len, int max_len) { out << "1009\n"; out << "6\n"; x.random_string(out, 15, 15); // locator x.random_string(out, 0, 0); // x.random_string(out, 2, 2); // version x.random_string(out, 10, 30); // misc info handler * y = (b_ptr -> get_obj_dict()).get_handler( form("%s.%s", b_ptr -> get_base_name(), "sgml.dict") ); x.random_string_to_be_compressed(out, min_len, max_len, y -> its_oid()); // graphic x.random_string(out, 10, 30); // title }
void generate_toc_instance(random_gen& x, ostream& out, int instance_num, int min_nodes, int max_nodes) { out << "1003\n"; out << "4\n"; x.random_oid(out, 1001, instance_num); // toc node id x.random_oid(out, 1001, 0); // parent node id x.random_integer(out); // out << "106\n"; out << "#\n"; int nodes = x.pick_a_value(min_nodes, max_nodes); for ( int i=0; i<nodes; i++ ) x.random_oid(out, 1001, 0); // id out << "#\n"; }
material_type get_rand_material_type(random_gen &random, const rstage& rule) { int value = random.range(100); int sum = rule.nature_drop_rate; if (value < sum) { return mt_nature; } sum += rule.steel_drop_rate; if (value < sum) { return mt_iron; } sum += rule.bone_drop_rate; if (value < sum) { return mt_bone; } sum += rule.skin_drop_rate; if (value < sum) { return mt_skin; } return mt_mineral; }