public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //name strlength = rand.Next(100) + 1; strbuf = new byte[strlength]; rand.NextBytes(strbuf); //fill the whole buffer with random bytes for (int __x__ = 0; __x__ < strlength; __x__++) { if (strbuf[__x__] == 0) //replace null chars with non-null random ones { strbuf[__x__] = (byte)(rand.Next(254) + 1); } } strbuf[strlength - 1] = 0; //null terminate name = Encoding.ASCII.GetString(strbuf); //ground_truth_mesh ground_truth_mesh = new Messages.shape_msgs.Mesh(); ground_truth_mesh.Randomize(); //ground_truth_point_cloud ground_truth_point_cloud = new Messages.sensor_msgs.PointCloud2(); ground_truth_point_cloud.Randomize(); }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //header header = new Header(); header.Randomize(); //type type = new Messages.object_recognition_msgs.ObjectType(); type.Randomize(); //confidence confidence = (float)(rand.Next() + rand.NextDouble()); //point_clouds arraylength = rand.Next(10); if (point_clouds == null) { point_clouds = new Messages.sensor_msgs.PointCloud2[arraylength]; } else { Array.Resize(ref point_clouds, arraylength); } for (int i = 0; i < point_clouds.Length; i++) { //point_clouds[i] point_clouds[i] = new Messages.sensor_msgs.PointCloud2(); point_clouds[i].Randomize(); } //bounding_mesh bounding_mesh = new Messages.shape_msgs.Mesh(); bounding_mesh.Randomize(); //bounding_contours arraylength = rand.Next(10); if (bounding_contours == null) { bounding_contours = new Point[arraylength]; } else { Array.Resize(ref bounding_contours, arraylength); } for (int i = 0; i < bounding_contours.Length; i++) { //bounding_contours[i] bounding_contours[i] = new Point(); bounding_contours[i].Randomize(); } //pose pose = new PoseWithCovarianceStamped(); pose.Randomize(); }