Showing the changes to src/core/ulib_std.cpp (1 of 37 files). Show all
Unified · Split
| @@ -318,8 +318,9 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 317 unmodified lines | |||
| 318 | // finish class | 318 | // finish class |
| 319 | QUERY->end_class( QUERY ); | 319 | QUERY->end_class( QUERY ); |
| 320 | 320 | ||
| 321 | // seed the rand | 321 | // seed rand() |
| 322 | srand( time( NULL ) ); | 322 | // (NOTE: ck_srandom(time(NULL)) is invoked in ulib_math.cpp) |
| 323 | srand( (unsigned)time( NULL ) ); | ||
| 323 | 324 | ||
| 324 | Chuck_DL_Func * func = NULL; | 325 | Chuck_DL_Func * func = NULL; |
| 325 | 326 | ||
| @@ -574,17 +575,17 @@ error: · 248 unmodified lines | |||
| 574 | } | 575 | } |
| 575 | 576 | ||
| 576 | 577 | ||
| 577 | #define RAND_INV_RANGE(r) (RAND_MAX / (r)) | 578 | //#define RAND_INV_RANGE(r) (RAND_MAX / (r)) |
| 578 | 579 | // | |
| 579 | int irand_exclusive ( int max ) { | 580 | //int irand_exclusive ( int max ) { |
| 580 | int x = ::rand(); | 581 | // int x = ::rand(); |
| 581 | 582 | // | |
| 582 | while (x >= max * RAND_INV_RANGE (max)) | 583 | // while (x >= max * RAND_INV_RANGE (max)) |
| 583 | x = ::rand(); | 584 | // x = ::rand(); |
| 584 | 585 | // | |
| 585 | x /= RAND_INV_RANGE (max); | 586 | // x /= RAND_INV_RANGE (max); |
| 586 | return x; | 587 | // return x; |
| 587 | } | 588 | //} |
| 588 | 589 | ||
| 589 | 590 | ||
| 590 | // abs | 591 | // abs |
| @@ -651,7 +652,7 @@ CK_DLL_SFUN( rand2_impl ) // inclusive. · 60 unmodified lines | |||
| 651 | CK_DLL_SFUN( srand_impl ) | 652 | CK_DLL_SFUN( srand_impl ) |
| 652 | { | 653 | { |
| 653 | t_CKINT seed = GET_CK_INT(ARGS); | 654 | t_CKINT seed = GET_CK_INT(ARGS); |
| 654 | ::srand( seed ); | 655 | srand( (unsigned)seed ); |
| 655 | } | 656 | } |
| 656 | 657 | ||
| 657 | // sgn | 658 | // sgn |