diff options
author | unknown <joreland@mysql.com> | 2005-01-18 08:08:36 +0100 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2005-01-18 08:08:36 +0100 |
commit | 0eb1a8107f2b245b6bbcdc78d0a49a78996df3c9 (patch) | |
tree | 7870f7e16d840adcb9a0885c199894fff854dac6 /ndb | |
parent | 41c1a6c658d629c914cde4811074a0586caeb4a7 (diff) | |
download | mariadb-git-0eb1a8107f2b245b6bbcdc78d0a49a78996df3c9.tar.gz |
ndb - use reentrant functions in HugoCalulator
ndb/test/src/HugoCalculator.cpp:
Use reentrant function in HugoCalulator
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/test/src/HugoCalculator.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ndb/test/src/HugoCalculator.cpp b/ndb/test/src/HugoCalculator.cpp index aef81501ea0..8493388efbd 100644 --- a/ndb/test/src/HugoCalculator.cpp +++ b/ndb/test/src/HugoCalculator.cpp @@ -72,13 +72,14 @@ HugoCalculator::Int64 calcValue(int record, int attrib, int updates) const; HugoCalculator::float calcValue(int record, int attrib, int updates) const; HugoCalculator::double calcValue(int record, int attrib, int updates) const; #endif + const char* HugoCalculator::calcValue(int record, int attrib, int updates, char* buf, int len) const { - + unsigned seed; const NdbDictionary::Column* attr = m_tab.getColumn(attrib); Uint32 val; do @@ -98,16 +99,15 @@ HugoCalculator::calcValue(int record, if (attr->getPrimaryKey()) { - srand(record + attrib); - val = (record + attrib); + seed = record + attrib; } else { - srand(record + attrib + updates); - val = rand(); + seed = record + attrib + updates; } } while (0); - + val = rand_r(&seed); + if(attr->getNullable() && (((val >> 16) & 255) > 220)) return NULL; @@ -115,14 +115,14 @@ HugoCalculator::calcValue(int record, int pos= 4; while(pos + 4 < len) { - val= rand(); + val= rand_r(&seed); memcpy(buf+pos, &val, 4); pos++; } if(pos < len) { - val= rand(); + val= rand_r(&seed); memcpy(buf+pos, &val, (len - pos)); } |