Skip to content

Commit 21ee353

Browse files
committed
Add _nmod_vec_rand
1 parent 95c6fdf commit 21ee353

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/nmod_vec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ void _nmod_vec_clear(nn_ptr vec)
4646
}
4747

4848
void _nmod_vec_randtest(nn_ptr vec, flint_rand_t state, slong len, nmod_t mod);
49+
void _nmod_vec_rand(nn_ptr vec, flint_rand_t state, slong len, nmod_t mod);
50+
4951

5052
NMOD_VEC_INLINE
5153
void _nmod_vec_zero(nn_ptr vec, slong len)

src/nmod_vec/randtest.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
#include "nmod_vec.h"
1313

14+
void _nmod_vec_rand(nn_ptr vec, flint_rand_t state, slong len, nmod_t mod)
15+
{
16+
slong i;
17+
for (i = 0; i < len; i++)
18+
vec[i] = n_randint(state, mod.n);
19+
}
20+
1421
void _nmod_vec_randtest(nn_ptr vec, flint_rand_t state, slong len, nmod_t mod)
1522
{
1623
slong i, sparseness;

0 commit comments

Comments
 (0)