summaryrefslogtreecommitdiff
path: root/src/librandom/rrandom_finish.c
blob: c2d499211c5f1b7c8305e54d0f56eacca0cc8d62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <skalibs/unirandom.h>
#include <skalibs/rrandom.h>

int rrandom_finish (rrandom *z)
{
  rrandom zero = RRANDOM_ZERO ;
  unsigned int i = z->n ;
  int e = 1 ;
  while (i--) e &= unirandom_finish(&z->tries[i].it) ;
  if (e) *z = zero ;
  return e ;
}