NAME
asn1_long_random_item
asn1_long_random_seed
asn1_long_random_turn
asn1_long_random
asn1_long_random_nbits
asn1_long_random_low
- generate random long integers
SYNOPSIS
#include asn1.h
ASN1_LONG_ITEM asn1_long_random_item(void);
void asn1_long_random(li, length)
asn1_long *li;
int length;
void asn1_long_random_nbits(li, nbits)
asn1_long *li;
int nbits;
void asn1_long_random_low(li, li_max)
asn1_long *li, *li_max;
void asn1_long_random_seed(l)
ASN1_LONG_ITEM l;
void asn1_long_turn(i)
int i;
DESCRIPTION
The ASN.1 library routines allow C programmers to describe arbitrary
data structures in a machine-independent fashion.
All ASN.1 routines require the header
"asn1.h"
to be include.
These routines generates pseudo-random numbers using arbitrary
length integer arithmetic. The long integers are stored using the
defined type
asn1_long
(see asn1_long(9x)) :
-
asn1_long_random_item(\|)
returns
ASN1_LONG_ITEM.
-
asn1_long_random(\|)
returns long integer of the specified length.
-
asn1_long_random_nbits(\|)
returns long integer of the specified number of bits.
-
asn1_long_random_low(\|)
returns non-negative long integer uniformly distributed over the
interval (0,
li_max
).
-
asn1_long_random_seed(\|)
can be called at any time to reset the random-number generator
to a random starting point.
-
asn1_long_random_turn(\|)
can be called at any time to "randomize" the random-number generator.
Calling
asn1_long_random_turn(\|)
is equivalent to calling
"i"
times the random-number generator; for this reason you should avoid assigning
a large value to
"i".
asn1_long_random_seed(\|)
and asn1_long_random_turn(\|)
can be used to produce unforeseeable random numbers, to avoid
connections between the samples obtained on different days.
This can be done, for example, by choosing random external values for
"l"
or
"i",
like process number, machine address, the running time of a task,
or an external "analog" number generator.
"SEE ALSO"
mavcod (9x),
mavros (9x),
mavros-output (9x),
asn1_time (9x),
asn1_malloc (9x),
asn1_long (9x),
asn1_longmath (9x),
asn1_longio (9x),
asn1_longprime (9x)
C. Huitema,
"General Presentation of the MAVROS Compiler",INRIA, 1990