I'm also not sure about the rand() function.in C rand() should return a value >=0 and < RAND_MAX which is at least 32767 on any standard library implementation (would you pls check this point?).So in your example the result

now there are 2 ways to go:- either you'll wait until Robomatter will have fixed these issues- or I can provide you with a code which features a quite good pseudo random number generator (PRNG, a linear congruence generator = LCG by K&R ) which works very reliable and highly equally distributed even over subsets of modulo.

(I also got an extremely high-level PRNG based on a Mersenne Twister, but this code possibly is beyond the scope of what is necessary.)

It would be helpful if you could check and display the value ofRAND_MAXto see how it already has been implemented by RC and to what value it will be expanded (probably 2.147.483.647 (max_signed_long) or even bigger (max_unsigned_long)).

does work. It returns values from 0 <=5000I will use that until it is solved.I use it just for testing the accuracy and repeatabillity of a delta robot, so real randomness or advanced functions is not important.I am just trying to use less variables.

Thanks for the heads up on this one. The random and rand functions have a known issue that we are working on; in the meantime, you can use randlong in the meantime, but you will need to make one modification to the RobotCIntrinsics.c file (typically found in the C:/Program Files (x86)/Robomatter Inc/ROBOTC Development Environment/Includes directory). You will need to remove the #if and #endif lines from the following segment of code:

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum