srand_deterministic

This commit is contained in:
sthen 2014-12-09 20:45:59 +00:00
parent feef5418bf
commit b753bbad14
9 changed files with 83 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.29 2013/03/11 15:26:14 bcallah Exp $
# $OpenBSD: Makefile,v 1.30 2014/12/09 20:46:00 sthen Exp $
BROKEN-hppa = undefined reference to __sync atomic ops
BROKEN-mips64 = undefined reference to __sync atomic ops
@ -8,6 +8,7 @@ COMMENT = cross-platform 3D audio API
V = 1.15.1
EPOCH = 0
REVISION = 0
DISTNAME = openal-soft-$V
PKGNAME = openal-$V
CATEGORIES = audio

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-utils_makehrtf_c,v 1.1 2014/12/09 20:46:00 sthen Exp $
--- utils/makehrtf.c.orig Tue Dec 9 20:40:59 2014
+++ utils/makehrtf.c Tue Dec 9 20:41:24 2014
@@ -2017,7 +2017,7 @@ static int StoreMhr (const HrirDataT * hData, const ch
step = hData -> mIrSize;
end = hData -> mIrCount * step;
n = hData -> mIrPoints;
- srand (0x31DF840C);
+ srand_deterministic (0x31DF840C);
for (j = 0; j < end; j += step) {
hpHist = 0;
for (i = 0; i < n; i ++) {
@@ -2072,7 +2072,7 @@ static int StoreTable (const HrirDataT * hData, const
"static const ALshort defaultCoeffs[%u] =\n{\n", hData -> mIrCount * n);
if (! WriteAscii (text, fp, filename))
return (0);
- srand (0x31DF840C);
+ srand_deterministic (0x31DF840C);
for (j = 0; j < end; j += step) {
if (! WriteAscii (" ", fp, filename))
return (0);

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.44 2013/03/10 22:55:06 espie Exp $
# $OpenBSD: Makefile,v 1.45 2014/12/09 20:45:59 sthen Exp $
COMMENT= MIDI to WAV renderer and player
V= 2.13.2
DISTNAME= TiMidity++-${V}
PKGNAME= timidity-${V}
REVISION= 4
REVISION= 5
CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=timidity/}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-TiMidity++-2_13_2_timidity_common_c,v 1.1 2014/12/09 20:46:00 sthen Exp $
--- TiMidity++-2.13.2/timidity/common.c.orig Tue Dec 9 20:33:09 2014
+++ TiMidity++-2.13.2/timidity/common.c Tue Dec 9 20:33:30 2014
@@ -1133,7 +1133,7 @@ int int_rand(int n)
if(n == -1)
srand(time(NULL));
else
- srand(-n);
+ srand_deterministic(-n);
return n;
}
return (int)(n * (double)rand() * (1.0 / (RAND_MAX + 1.0)));

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.11 2014/10/13 19:10:44 sthen Exp $
# $OpenBSD: Makefile,v 1.12 2014/12/09 20:46:00 sthen Exp $
# -Winit-self
NOT_FOR_ARCHS= ${GCC3_ARCHS}
@ -6,7 +6,7 @@ NOT_FOR_ARCHS= ${GCC3_ARCHS}
COMMENT= enhanced performance test of filesystem I/O
DISTNAME= bonnie++-1.97
REVISION= 0
REVISION= 1
WRKDIST= ${WRKDIR}/${DISTNAME}.1
CATEGORIES= benchmarks
MASTER_SITES= http://www.coker.com.au/bonnie++/experimental/

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-generate_randfile_cpp,v 1.1 2014/12/09 20:46:00 sthen Exp $
--- generate_randfile.cpp.orig Tue Dec 9 20:36:30 2014
+++ generate_randfile.cpp Tue Dec 9 20:36:36 2014
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
if(optind >= argc)
usage();
int count = atoi(argv[optind]);
- srand(seed);
+ srand_deterministic(seed);
fprintf(stderr, "Generating %d random numbers with seed %d.\n", count, seed);
for(int i = 0; i < count; i++)
{

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-rand_cpp,v 1.1 2014/12/09 20:46:00 sthen Exp $
--- rand.cpp.orig Tue Dec 9 20:35:55 2014
+++ rand.cpp Tue Dec 9 20:36:20 2014
@@ -40,7 +40,7 @@ void Rand::seedNum(UINT num)
delete(m_arr);
m_arr = NULL;
m_size = 0;
- srand(num);
+ srand_deterministic(num);
m_init = num;
char buf[12];
sprintf(buf, "%u", num);
@@ -52,5 +52,5 @@ void Rand::reset()
if(m_arr)
m_ind = -1;
else
- srand(m_init);
+ srand_deterministic(m_init);
}

View File

@ -1,16 +1,14 @@
# $OpenBSD: Makefile,v 1.7 2013/03/11 10:50:02 espie Exp $
# $OpenBSD: Makefile,v 1.8 2014/12/09 20:46:00 sthen Exp $
COMMENT = patch-set and bug tracking system for CVS
DISTNAME = cvstrac-2.0.1
PKGNAME = ${DISTNAME}
REVISION = 2
REVISION = 3
CATEGORIES = devel www
HOMEPAGE = http://www.cvstrac.org/
MAINTAINER = Stuart Henderson <sthen@openbsd.org>
# GPLv2+
PERMIT_PACKAGE_CDROM = Yes

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-maketestdb_c,v 1.1.1.1 2009/02/17 00:16:04 sthen Exp $
$OpenBSD: patch-maketestdb_c,v 1.2 2014/12/09 20:46:00 sthen Exp $
http://www.cvstrac.org/cvstrac/chngview?cn=969
Use sqlite3_free() not free() on functions returning memory strings.
--- maketestdb.c.orig Tue Mar 28 02:38:54 2006
+++ maketestdb.c Thu Aug 7 01:10:02 2008
+++ maketestdb.c Tue Dec 9 20:43:06 2014
@@ -62,7 +62,7 @@ static void generate_chng(sqlite3 *db, time_t when, in
sprintf(zBase,"dir_%d",rand()%MAX_DIR);
zSql = sqlite3_mprintf("REPLACE INTO file VALUES(1,'%q','%q')",zBase,zDir);
@ -40,3 +40,12 @@ Use sqlite3_free() not free() on functions returning memory strings.
}
/***********************************************************************/
@@ -244,7 +244,7 @@ int main(int argc, char **argv){
}
/* a certain amount of repeatability is nice */
- srand(0);
+ srand_deterministic(0);
/* Initialize the database */
rc = sqlite3_exec(db,zSchema,0,0,&zErrMsg);