Changeset 0b1f01c in mainline
- Timestamp:
- 2024-06-13T16:03:39Z (3 months ago)
- Branches:
- master
- Children:
- 3887aab2
- Parents:
- 221daa5
- git-author:
- Miroslav Cimerman <mc@…> (2024-06-12 20:50:42)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2024-06-13 16:03:39)
- Location:
- uspace/lib/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/rndgen.c
r221daa5 r0b1f01c 92 92 } 93 93 94 /** Generate random 16-bit integer. 95 * 96 * @param rndgen Random number generator 97 * @param rw Place to store random 16-bit integer 98 * @return EOK on success or error code 99 */ 100 errno_t rndgen_uint16(rndgen_t *rndgen, uint16_t *rw) 101 { 102 int i; 103 uint8_t b; 104 uint16_t w; 105 errno_t rc; 106 107 w = 0; 108 for (i = 0; i < 2; i++) { 109 rc = rndgen_uint8(rndgen, &b); 110 if (rc != EOK) 111 return rc; 112 113 w = (w << 8) | b; 114 } 115 116 *rw = w; 117 return EOK; 118 } 119 94 120 /** Generate random 32-bit integer. 95 121 * -
uspace/lib/c/include/rndgen.h
r221daa5 r0b1f01c 47 47 extern void rndgen_destroy(rndgen_t *); 48 48 extern errno_t rndgen_uint8(rndgen_t *, uint8_t *); 49 extern errno_t rndgen_uint16(rndgen_t *, uint16_t *); 49 50 extern errno_t rndgen_uint32(rndgen_t *, uint32_t *); 50 51
Note:
See TracChangeset
for help on using the changeset viewer.