Changeset 407e251 in mainline
- Timestamp:
- 2024-06-12T20:50:42Z (3 months ago)
- Children:
- d85d4f2
- Parents:
- c4ed9fa
- Location:
- uspace/lib/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/rndgen.c
rc4ed9fa r407e251 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
rc4ed9fa r407e251 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.