[DEV] add random table generation
This commit is contained in:
parent
28ffa0fb75
commit
cbd47f11f2
20
etk/tool.cpp
20
etk/tool.cpp
@ -25,6 +25,26 @@ int32_t etk::tool::irand(int32_t a, int32_t b)
|
||||
return (int32_t)(( rand()/(float)RAND_MAX ) * ((float)b-(float)a) + (float)a);
|
||||
}
|
||||
|
||||
void etk::tool::frandTable(float a, float b, int32_t size, float* table)
|
||||
{
|
||||
if (NULL==table) {
|
||||
return;
|
||||
}
|
||||
for(int32_t iii=0; iii<size; iii++) {
|
||||
table[iii] = frand(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
void etk::tool::irandTable(int32_t a, int32_t b, int32_t size, int32_t* table)
|
||||
{
|
||||
if (NULL==table) {
|
||||
return;
|
||||
}
|
||||
for(int32_t iii=0; iii<size; iii++) {
|
||||
table[iii] = frand(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void etk::tool::SortList(etk::Vector<etk::UString *> &m_listDirectory)
|
||||
{
|
||||
|
@ -16,9 +16,13 @@ namespace etk {
|
||||
namespace tool {
|
||||
float frand(float a, float b);
|
||||
int32_t irand(int32_t a, int32_t b);
|
||||
void frandTable(float a, float b, int32_t size, float* table);
|
||||
void irandTable(int32_t a, int32_t b, int32_t size, int32_t* table);
|
||||
|
||||
void SortList(etk::Vector<etk::UString *> &m_listDirectory);
|
||||
bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen);
|
||||
etk::UString SimplifyPath(etk::UString input);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user