fix frand to return value in interval [0,1)
This commit is contained in:
parent
151bfe9ee1
commit
bf2ad65836
2 changed files with 2 additions and 1 deletions
|
@ -161,7 +161,7 @@ struct ggml_tensor * randomize_tensor_uniform(struct ggml_tensor * tensor, struc
|
|||
}
|
||||
|
||||
float frand() {
|
||||
return (float)rand()/(float)RAND_MAX;
|
||||
return (float)rand()/((float)(RAND_MAX) + 1.0f);
|
||||
}
|
||||
|
||||
float frand_normal(struct random_normal_distribution * rnd) {
|
||||
|
|
|
@ -124,6 +124,7 @@ void free_random_uniform_distribution(struct random_uniform_distribution * rnd);
|
|||
struct ggml_tensor * randomize_tensor_normal (struct ggml_tensor * tensor, struct random_normal_distribution * rnd);
|
||||
struct ggml_tensor * randomize_tensor_uniform(struct ggml_tensor * tensor, struct random_uniform_distribution * rnd);
|
||||
|
||||
// generate random float in interval [0,1)
|
||||
float frand();
|
||||
float frand_normal (struct random_normal_distribution * rnd);
|
||||
float frand_uniform(struct random_uniform_distribution * rnd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue