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();
        }
Exemplo n.º 2
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //cloud
            cloud = new Messages.sensor_msgs.PointCloud2();
            cloud.Randomize();
            //polygons
            arraylength = rand.Next(10);
            if (polygons == null)
            {
                polygons = new Messages.pcl_msgs.Vertices[arraylength];
            }
            else
            {
                Array.Resize(ref polygons, arraylength);
            }
            for (int i = 0; i < polygons.Length; i++)
            {
                //polygons[i]
                polygons[i] = new Messages.pcl_msgs.Vertices();
                polygons[i].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 = (uint)rand.Next();
            //points
            points = new Messages.sensor_msgs.PointCloud2();
            points.Randomize();
        }