mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-16 10:39:49 +00:00
Fix #1616 - randomize mqtt will and client id for parallel test
This commit is contained in:
1 parent
432452ea9a
commit
81ffcd8ee9
6 files changed
+52
-3
No files matched your search
@@ -3239,6 +3239,27 @@ char buf[10];
|
||||
mg_random(buf, sizeof(buf)); // `buf` is now random bytes
|
||||
```
|
||||
|
||||
### mg\_random\_str()
|
||||
|
||||
```c
|
||||
char *mg_random_str(char *buf, size_t len);
|
||||
```
|
||||
|
||||
Fill in buffer `buf`, `len` with random alphanumeric characters: `a-zA-Z0-9`.
|
||||
A buffer is zero-terminated.
|
||||
|
||||
Parameters:
|
||||
- `buf` - a pointer to a buffer
|
||||
- `len` - a buffer size
|
||||
|
||||
Return value: `buf` value.
|
||||
|
||||
Usage example:
|
||||
```c
|
||||
char buf[10];
|
||||
printf("Random: %s\n", mg_random_str(buf, sizeof(buf)));
|
||||
```
|
||||
|
||||
### mg\_ntohs()
|
||||
|
||||
```c
|
||||
|
||||
Reference in new issue
Block a user