Rename psf_rand_long -> psf_rand_int32.

This commit is contained in:
Erik de Castro Lopo 2007-07-17 18:06:27 +10:00
parent e35511f9af
commit ea1f70fa87
3 changed files with 12 additions and 12 deletions

View File

@ -5,7 +5,7 @@
FLAC__metadata_object_vorbiscomment_append_comment.
* src/common.[ch]
Add function psf_rand_long().
Add function psf_rand_int32().
2007-07-14 Erik de Castro Lopo <erikd AT mega-nerd DOT com>

View File

@ -1283,21 +1283,21 @@ u_bitwidth_to_subformat (int bits)
} /* bitwidth_to_subformat */
/*
** psf_rand_long : Not crypto quality, but more than adequate for things
** psf_rand_int32 : Not crypto quality, but more than adequate for things
** like stream serial numbers in Ogg files.
*/
long
psf_rand_long (void)
{ static long serial = -1 ;
int32_t
psf_rand_int32 (void)
{ static int32_t value = -1 ;
int k, count ;
if (serial == -1)
serial = time (NULL) ;
if (value == -1)
value = time (NULL) ;
count = 4 + (serial & 7) ;
count = 4 + (value & 7) ;
for (k = 0 ; k < count ; k++)
serial = 11117 * serial + 211231 ;
value = 11117 * value + 211231 ;
return serial ;
} /* psf_rand_long */
return value ;
} /* psf_rand_int32 */

View File

@ -589,7 +589,7 @@ void psf_log_SF_INFO (SF_PRIVATE *psf) ;
void psf_hexdump (const void *ptr, int len) ;
long psf_rand_long (void) ;
int32_t psf_rand_int32 (void) ;
/* Functions used when writing file headers. */