summaryrefslogtreecommitdiff
path: root/src/librandom/rrandom_finish.c
blob: a3cb24b522c5e527a37522078ffe96836f6b15bd (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_ref 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 ;
}