Пример #1
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //header
                header = new Header();
                header.Randomize();
                //pose
                pose = new Pose();
                pose.Randomize();
                //twist
                twist = new Twist();
                twist.Randomize();
                //success
                success = rand.Next(2) == 1;
                //status_message
                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
                status_message        = Encoding.ASCII.GetString(strbuf);
            }
Пример #2
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //pose
            pose = new Pose();
            pose.Randomize();
            //twist
            twist = new Twist();
            twist.Randomize();
            //wrench
            wrench = new Wrench();
            wrench.Randomize();
        }