public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //header header = new Messages.rosgardener.ChannelCommand(); header.Randomize(); //message_id 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 message_id = Encoding.ASCII.GetString(strbuf); //message_body 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 message_body = Encoding.ASCII.GetString(strbuf); //attachments arraylength = rand.Next(10); if (attachments == null) { attachments = new Messages.std_msgs.ByteMultiArray[arraylength]; } else { Array.Resize(ref attachments, arraylength); } for (int i = 0; i < attachments.Length; i++) { //attachments[i] attachments[i] = new Messages.std_msgs.ByteMultiArray(); attachments[i].Randomize(); } }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //command command = new Messages.rosgardener.ChannelCommand(); command.Randomize(); }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //response response = new Messages.rosgardener.ChannelCommand(); response.Randomize(); //success success = rand.Next(2) == 1; }