1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

Replace scm_c_generalized_vector_length in random.c

* libguile/random.c: (random:solid-sphere!): array is of known
  rank 1, so use scm_c_array_length() instead.
This commit is contained in:
Daniel Llorens 2013-04-09 18:09:49 +02:00 committed by Andy Wingo
parent 7e7e3b7f06
commit 4a7dac39a9

View file

@ -582,13 +582,13 @@ SCM_DEFINE (scm_random_solid_sphere_x, "random:solid-sphere!", 1, 1, 0,
scm_random_normal_vector_x (v, state); scm_random_normal_vector_x (v, state);
vector_scale_x (v, vector_scale_x (v,
pow (scm_c_uniform01 (SCM_RSTATE (state)), pow (scm_c_uniform01 (SCM_RSTATE (state)),
1.0 / scm_c_generalized_vector_length (v)) 1.0 / scm_c_array_length (v))
/ sqrt (vector_sum_squares (v))); / sqrt (vector_sum_squares (v)));
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }
#undef FUNC_NAME #undef FUNC_NAME
SCM_DEFINE (scm_random_hollow_sphere_x, "random:hollow-sphere!", 1, 1, 0, SCM_DEFINE (scm_random_hollow_sphere_x, "random:hollow-sphere!", 1, 1, 0,
(SCM v, SCM state), (SCM v, SCM state),
"Fills vect with inexact real random numbers\n" "Fills vect with inexact real random numbers\n"
"the sum of whose squares is equal to 1.0.\n" "the sum of whose squares is equal to 1.0.\n"