public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //body_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 body_name = Encoding.ASCII.GetString(strbuf); //reference_frame 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 reference_frame = Encoding.ASCII.GetString(strbuf); //reference_point reference_point = new Point(); reference_point.Randomize(); //wrench wrench = new Wrench(); wrench.Randomize(); //start_time start_time = new Time(new TimeData( Convert.ToUInt32(rand.Next()), Convert.ToUInt32(rand.Next()))); //duration duration = new Duration(new TimeData( Convert.ToUInt32(rand.Next()), Convert.ToUInt32(rand.Next()))); }
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(); }
public override void Randomize() { int arraylength = -1; Random rand = new Random(); int strlength; byte[] strbuf, myByte; //info 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 info = Encoding.ASCII.GetString(strbuf); //collision1_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 collision1_name = Encoding.ASCII.GetString(strbuf); //collision2_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 collision2_name = Encoding.ASCII.GetString(strbuf); //wrenches arraylength = rand.Next(10); if (wrenches == null) { wrenches = new Wrench[arraylength]; } else { Array.Resize(ref wrenches, arraylength); } for (int i = 0; i < wrenches.Length; i++) { //wrenches[i] wrenches[i] = new Wrench(); wrenches[i].Randomize(); } //total_wrench total_wrench = new Wrench(); total_wrench.Randomize(); //contact_positions arraylength = rand.Next(10); if (contact_positions == null) { contact_positions = new Vector3[arraylength]; } else { Array.Resize(ref contact_positions, arraylength); } for (int i = 0; i < contact_positions.Length; i++) { //contact_positions[i] contact_positions[i] = new Vector3(); contact_positions[i].Randomize(); } //contact_normals arraylength = rand.Next(10); if (contact_normals == null) { contact_normals = new Vector3[arraylength]; } else { Array.Resize(ref contact_normals, arraylength); } for (int i = 0; i < contact_normals.Length; i++) { //contact_normals[i] contact_normals[i] = new Vector3(); contact_normals[i].Randomize(); } //depths arraylength = rand.Next(10); if (depths == null) { depths = new double[arraylength]; } else { Array.Resize(ref depths, arraylength); } for (int i = 0; i < depths.Length; i++) { //depths[i] depths[i] = (rand.Next() + rand.NextDouble()); } }