[DEV] add random table generation

This commit is contained in:
Edouard DUPIN 2013-02-28 07:51:10 +01:00
parent 28ffa0fb75
commit cbd47f11f2
2 changed files with 24 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);
};
};