Skip to content

Commit 6c8ea09

Browse files
committed
Use OPAL random generator.
This fix is related to issue #1877, and prevents the OMPI library from messing the user level random values. Signed-off-by: George Bosilca <[email protected]>
1 parent 5542559 commit 6c8ea09

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ompi/mca/topo/treematch/treematch/tm_malloc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <stdio.h>
33
#include "tm_verbose.h"
44
#include "tm_malloc.h"
5+
#include "opal/util/alfg.h"
56

67
#define EXTRA_BYTE 100
78

@@ -67,15 +68,16 @@ void my_mem_check(void){
6768

6869
void init_extra_data(void){
6970
static int done = 0;
71+
opal_rng_buff_t rng;
7072
int i;
7173

7274
if(done)
7375
return;
7476

75-
srandom(0);
77+
opal_srand(&rng,0);
7678

7779
for( i = 0 ; i < EXTRA_BYTE; i++)
78-
extra_data[i] = (char) random() % 256;
80+
extra_data[i] = (char) opal_rand(&rng) % 256;
7981

8082
done = 1;
8183
}

0 commit comments

Comments
 (0)