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 | 318 | // finish class |
| 319 | 319 | QUERY->end_class( QUERY ); |
| 320 | 320 | |
| 321 | − // seed the rand | |
| 322 | − srand( time( NULL ) ); | |
| 321 | + // seed rand() | |
| 322 | + // (NOTE: ck_srandom(time(NULL)) is invoked in ulib_math.cpp) | |
| 323 | + srand( (unsigned)time( NULL ) ); | |
| 323 | 324 | |
| 324 | 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 | − | |
| 579 | −int irand_exclusive ( int max ) { | |
| 580 | − int x = ::rand(); | |
| 581 | − | |
| 582 | − while (x >= max * RAND_INV_RANGE (max)) | |
| 583 | − x = ::rand(); | |
| 584 | − | |
| 585 | − x /= RAND_INV_RANGE (max); | |
| 586 | − return x; | |
| 587 | −} | |
| 578 | +//#define RAND_INV_RANGE(r) (RAND_MAX / (r)) | |
| 579 | +// | |
| 580 | +//int irand_exclusive ( int max ) { | |
| 581 | +// int x = ::rand(); | |
| 582 | +// | |
| 583 | +// while (x >= max * RAND_INV_RANGE (max)) | |
| 584 | +// x = ::rand(); | |
| 585 | +// | |
| 586 | +// x /= RAND_INV_RANGE (max); | |
| 587 | +// return x; | |
| 588 | +//} | |
| 588 | 589 | |
| 589 | 590 | |
| 590 | 591 | // abs |
| @@ -651,7 +652,7 @@ CK_DLL_SFUN( rand2_impl ) // inclusive. · 60 unmodified lines | ||
| 651 | 652 | CK_DLL_SFUN( srand_impl ) |
| 652 | 653 | { |
| 653 | 654 | t_CKINT seed = GET_CK_INT(ARGS); |
| 654 | − ::srand( seed ); | |
| 655 | + srand( (unsigned)seed ); | |
| 655 | 656 | } |
| 656 | 657 | |
| 657 | 658 | // sgn |