strfile.c (19291) | strfile.c (29774) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ken Arnold. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 415 unchanged lines hidden (view full) --- 424 * randomization is done within each block. 425 */ 426void randomize() 427{ 428 register int cnt, i; 429 register long tmp; 430 register long *sp; 431 | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ken Arnold. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 415 unchanged lines hidden (view full) --- 424 * randomization is done within each block. 425 */ 426void randomize() 427{ 428 register int cnt, i; 429 register long tmp; 430 register long *sp; 431 |
432 srandom((int)(time((time_t *) NULL) ^ getpid())); | 432 srandomdev(); |
433 434 Tbl.str_flags |= STR_RANDOM; 435 cnt = Tbl.str_numstr; 436 437 /* 438 * move things around randomly 439 */ 440 441 for (sp = Seekpts; cnt > 0; cnt--, sp++) { 442 i = random() % cnt; 443 tmp = sp[0]; 444 sp[0] = sp[i]; 445 sp[i] = tmp; 446 } 447} | 433 434 Tbl.str_flags |= STR_RANDOM; 435 cnt = Tbl.str_numstr; 436 437 /* 438 * move things around randomly 439 */ 440 441 for (sp = Seekpts; cnt > 0; cnt--, sp++) { 442 i = random() % cnt; 443 tmp = sp[0]; 444 sp[0] = sp[i]; 445 sp[i] = tmp; 446 } 447} |