Was the Random Number Generator removed from the Simple Tools Library
Shawna
Posts: 508
in Propeller 1
I am looking for a Random Number Generator to test a number sorting algorithm I found. I use Blocklyprop sometimes to help me find functions for various things and to help me format my syntax. I put together a program in Blocklyprop to display a random number.
This is the code in Blocklyprop that compiles.
When I try to build this in Simple IDE, it gives me an error.
Looking through the Simple Tools library I cannot find a random number generator function. Searching through the forums I can only find one written in spin. Maybe this is a good time for me to try spin2cpp.
I realize that it is very hard or even impossible to generate a true random number. I just wanted to automate testing my number sorter.
Was the Random Number generator remove from the Simple Tools Library.
Thanks
Shawn A.
This is the code in Blocklyprop that compiles.
/* SERIAL_TERMINAL USED */ // ------ Libraries and Definitions ------ #include "simpletools.h" // ------ Global Variables and Objects ------ int Random; // ------ Main Program ------ int main() { print("Random Number"); print("\r"); while (1) { Random = (random(1, 100)); print("%d", Random); pause(1000); } }
When I try to build this in Simple IDE, it gives me an error.
BlocklyRandomNumber.c: In function 'main': BlocklyRandomNumber.c:18:5: warning: implicit declaration of function 'random' [-Wimplicit-function-declaration] C:\Users\Garage\AppData\Local\Temp\ccKtk0OV.o: In function `_main': (.text+0x22): undefined reference to `_random' Done. Build Failed! Check source for bad function call or global variable name `_random'
Looking through the Simple Tools library I cannot find a random number generator function. Searching through the forums I can only find one written in spin. Maybe this is a good time for me to try spin2cpp.
I realize that it is very hard or even impossible to generate a true random number. I just wanted to automate testing my number sorter.
Was the Random Number generator remove from the Simple Tools Library.
Thanks
Shawn A.
Comments
Look here: Propeller GCC
Sample code: Mike
Balancing Robot
Mike
Is that the activity bot chassis?
The tires look wider than the ones that come with the activity bot, but it looks like maybe your using the servos.
Very nice