Annotation of parser3/src/include/pa_random.h, revision 1.8

1.1       misha       1: /** @file
                      2:        Parser: random related functions.
                      3: 
1.8     ! moko        4:        Copyright (c) 2001-2020 Art. Lebedev Studio (http://www.artlebedev.com)
1.1       misha       5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
                      6: */
                      7: 
                      8: #ifndef PA_RANDOM_H
                      9: #define PA_RANDOM_H
                     10: 
1.8     ! moko       11: #define IDENT_PA_RANDOM_H "$Id: pa_random.h,v 1.7 2017/02/07 22:00:35 moko Exp $"
1.1       misha      12: 
                     13: #include "pa_types.h"
                     14: 
                     15: void random(void *buffer, size_t size);
                     16: 
1.6       moko       17: static inline int _random(int top) {
                     18:        uint32_t raw;
1.1       misha      19:        random(&raw, sizeof(raw));
1.6       moko       20:        return int( double(raw) / ((double)UINT32_MAX+1) * top );
1.1       misha      21: }
                     22: 
1.5       moko       23: char *get_uuid_cstr();
                     24: char *get_uuid_boundary();
1.1       misha      25: 
                     26: #endif

E-mail: