Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 155537 Details for
Bug 224933
sci-mathematics/snns-4.2 random seed bugs
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
patch proposed to upstream
4.2-random-seed-fixes.patch (text/plain), 1.41 KB, created by
Ian Stakenvicius (RETIRED)
on 2008-06-04 19:43:09 UTC
(
hide
)
Description:
patch proposed to upstream
Filename:
MIME Type:
Creator:
Ian Stakenvicius (RETIRED)
Created:
2008-06-04 19:43:09 UTC
Size:
1.41 KB
patch
obsolete
>diff -Naur SNNSv4.2/kernel/sources/init_f.c SNNSv4.2-patched/kernel/sources/init_f.c >--- SNNSv4.2/kernel/sources/init_f.c 2005-08-30 12:08:07.000000000 -0400 >+++ SNNSv4.2.new/kernel/sources/init_f.c 2005-08-30 12:16:15.000000000 -0400 >@@ -2259,6 +2259,12 @@ > > range = max_weight - min_weight ; > >+ /* >+ * PATCHED 2005-08-01 -- Sabit Cakmak >+ * Ensure the random number generator has been initialized, or an error may occur >+ */ >+ krui_setSeedNo(0); >+ > /* if (range < 0.0) return (KRERR_PARAMETERS) ; */ > > FOR_ALL_UNITS (unit_ptr) >diff -Naur SNNSv4.2/kernel/sources/kr_ui.c SNNSv4.2.new/kernel/sources/kr_ui.c >--- SNNSv4.2/kernel/sources/kr_ui.c 2008-06-04 11:18:09.000000000 -0400 >+++ SNNSv4.2.new/kernel/sources/kr_ui.c 2008-06-04 11:33:06.000000000 -0400 >@@ -57,6 +57,10 @@ > > #endif > >+/************ Random seed storage **************/ >+long randomSeedVal=0; >+/***********************************************/ >+ > /***************************************************************************** > FUNCTION : krui_getNoOfUnits > >@@ -4592,10 +4596,15 @@ > void krui_setSeedNo(long int seed) > { > >- if (seed != 0) >+ if (seed != 0) { >+ randomSeedVal = seed; > srand48( seed ); >- else >- srand48( (long) time( (time_t *) 0) ); >+ } else { >+ if (randomSeedVal == 0) { >+ randomSeedVal = (long) time( (time_t *) 0); >+ srand48( randomSeedVal ); >+ } >+ } > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 224933
: 155537