Simple patch for fix random bool vector generation (#10493)
* Dirty patch for fix bool generation * Bernoulli distribution for bool
This commit is contained in:
parent
5dbf2f7088
commit
11bf540018
@ -35,6 +35,12 @@ generateVector(size_t vec_len,
|
|||||||
res[i] = static_cast<dataType>(dist(gen));
|
res[i] = static_cast<dataType>(dist(gen));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
} else if (std::is_same<bool, dataType>()) {
|
||||||
|
std::bernoulli_distribution dist;
|
||||||
|
for (size_t i = 0; i < vec_len; i++) {
|
||||||
|
res[i] = static_cast<dataType>(dist(gen));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
} else {
|
} else {
|
||||||
// chose values between this range to avoid type overrun (e.g. in case of I8 precision)
|
// chose values between this range to avoid type overrun (e.g. in case of I8 precision)
|
||||||
std::uniform_int_distribution<long> dist(static_cast<long>(startFrom), static_cast<long>(upTo));
|
std::uniform_int_distribution<long> dist(static_cast<long>(startFrom), static_cast<long>(upTo));
|
||||||
|
Loading…
Reference in New Issue
Block a user