TDengine/include/os/osRand.h

44 lines
1.3 KiB
C
Raw Normal View History

2021-09-30 08:41:02 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2021-09-30 09:10:36 +00:00
#ifndef _TD_OS_RAND_H_
#define _TD_OS_RAND_H_
2021-09-30 08:41:02 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2022-03-09 16:36:30 +00:00
// If the error is in a third-party library, place this header file under the third-party library header file.
2022-03-21 16:54:21 +00:00
// When you want to use this feature, you should find or add the same function in the following section.
2022-03-09 16:36:30 +00:00
#ifndef ALLOW_FORBID_FUNC
2022-10-13 03:09:43 +00:00
#define rand RAND_FUNC_TAOS_FORBID
#define srand SRAND_FUNC_TAOS_FORBID
#define rand_r RANDR_FUNC_TAOS_FORBID
2022-03-09 16:36:30 +00:00
#endif
2022-10-13 03:09:43 +00:00
void taosSeedRand(uint32_t seed);
2021-09-30 08:41:02 +00:00
uint32_t taosRand(void);
2022-10-13 03:09:43 +00:00
uint32_t taosRandR(uint32_t* pSeed);
2021-09-30 08:41:02 +00:00
void taosRandStr(char* str, int32_t size);
2023-08-15 00:40:12 +00:00
void taosRandStr2(char* str, int32_t size);
2021-09-30 08:41:02 +00:00
uint32_t taosSafeRand(void);
#ifdef __cplusplus
}
#endif
2021-09-30 09:10:36 +00:00
#endif /*_TD_OS_RAND_H_*/