project_files/hwc/rtl/system.c
changeset 10625 125e120165aa
parent 10134 81d733899e06
child 10838 2abe883c9c21
equal deleted inserted replaced
10624:05bb44f4d92f 10625:125e120165aa
   294     FIX_STRING(s);
   294     FIX_STRING(s);
   295     *a = str_to_int(s.str);
   295     *a = str_to_int(s.str);
   296 }
   296 }
   297 
   297 
   298 LongInt fpcrtl_random(LongInt l) {
   298 LongInt fpcrtl_random(LongInt l) {
       
   299     // random(0) is undefined in docs but effectively returns 0 in free pascal
       
   300     if (l == 0) {
       
   301         printf("WARNING: random(0) called!");
       
   302         return 0;
       
   303     }
   299     return (LongInt) (rand() / (double) RAND_MAX * l);
   304     return (LongInt) (rand() / (double) RAND_MAX * l);
   300 }
   305 }
   301 
   306 
   302 void __attribute__((overloadable)) fpcrtl_str__vars(float x, string255 *s) {
   307 void __attribute__((overloadable)) fpcrtl_str__vars(float x, string255 *s) {
   303     sprintf(s->str, "%f", x);
   308     sprintf(s->str, "%f", x);