xorshift minor tweaks
This commit is contained in:
parent
c73476e5aa
commit
a7bb3bc812
BIN
C/out/samples
BIN
C/out/samples
Binary file not shown.
|
@ -167,7 +167,7 @@ void mixture(float (*samplers[])(uint32_t*), float* weights, int n_dists, float*
|
||||||
uint32_t** seeds = malloc(n_threads * sizeof(uint32_t*));
|
uint32_t** seeds = malloc(n_threads * sizeof(uint32_t*));
|
||||||
for (uint32_t i = 0; i < n_threads; i++) {
|
for (uint32_t i = 0; i < n_threads; i++) {
|
||||||
seeds[i] = malloc(sizeof(uint32_t));
|
seeds[i] = malloc(sizeof(uint32_t));
|
||||||
*seeds[i] = i + 1;
|
*seeds[i] = i + 1; // xorshift can't start with 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp parallel private(i, p1, sample_index, split_array_length)
|
#pragma omp parallel private(i, p1, sample_index, split_array_length)
|
||||||
|
|
|
@ -13,7 +13,7 @@ uint32_t xorshift32(uint32_t* state)
|
||||||
}
|
}
|
||||||
|
|
||||||
float rand_xorshift32(uint32_t* state){
|
float rand_xorshift32(uint32_t* state){
|
||||||
return (float) xorshift32(state) / UINT32_MAX;
|
return (float) xorshift32(state) / (float) UINT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user