summaryrefslogtreecommitdiff
path: root/nuttx/lib/lib_rand.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-02-20 22:39:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-02-20 22:39:56 +0000
commit630b4bdd3d2ca967f0e1d4f438f7f1761461dd31 (patch)
treef640e5eab1ce66cdeadd0ab3684ea326f56db8a5 /nuttx/lib/lib_rand.c
parentbd7dce092d36128a0f84e5544ccc857a45f6ba2f (diff)
downloadpx4-nuttx-630b4bdd3d2ca967f0e1d4f438f7f1761461dd31.tar.gz
px4-nuttx-630b4bdd3d2ca967f0e1d4f438f7f1761461dd31.tar.bz2
px4-nuttx-630b4bdd3d2ca967f0e1d4f438f7f1761461dd31.zip
Eliminating GCC dependencies
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@14 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/lib_rand.c')
-rw-r--r--nuttx/lib/lib_rand.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/nuttx/lib/lib_rand.c b/nuttx/lib/lib_rand.c
index 5ce708bc8..5dde2dd8c 100644
--- a/nuttx/lib/lib_rand.c
+++ b/nuttx/lib/lib_rand.c
@@ -81,11 +81,11 @@
************************************************************/
static unsigned int nrand(unsigned int nLimit);
-static double frand1(void);
+static double_t frand1(void);
#if (RND_ORDER > 1)
-static double frand2(void);
+static double_t frand2(void);
#if (RND_ORDER > 2)
-static double frand3(void);
+static double_t frand3(void);
#endif
#endif
@@ -140,7 +140,7 @@ int rand(void)
static unsigned int nrand(unsigned int nLimit)
{
unsigned long nResult;
- double fRatio;
+ double_t fRatio;
/* Loop to be sure a legal random number is generated */
do {
@@ -155,7 +155,7 @@ static unsigned int nrand(unsigned int nLimit)
#endif
/* Then, produce the return-able value */
- nResult = (unsigned long)(((double)nLimit) * fRatio);
+ nResult = (unsigned long)(((double_t)nLimit) * fRatio);
} while (nResult >= (unsigned long)nLimit);
@@ -163,7 +163,7 @@ static unsigned int nrand(unsigned int nLimit)
} /* end nrand */
-static double frand1(void)
+static double_t frand1(void)
{
unsigned long nRandInt;
@@ -172,12 +172,12 @@ static double frand1(void)
g_nRandInt1 = nRandInt;
/* Construct an floating point value in the range from 0.0 up to 1.0 */
- return ((double)nRandInt) / ((double)RND_CONSTP);
+ return ((double_t)nRandInt) / ((double_t)RND_CONSTP);
} /* end frand */
#if (RND_ORDER > 1)
-static double frand2(void)
+static double_t frand2(void)
{
unsigned long nRandInt;
@@ -188,12 +188,12 @@ static double frand2(void)
g_nRandInt1 = nRandInt;
/* Construct an floating point value in the range from 0.0 up to 1.0 */
- return ((double)nRandInt) / ((double)RND_CONSTP);
+ return ((double_t)nRandInt) / ((double_t)RND_CONSTP);
} /* end frand */
#if (RND_ORDER > 2)
-static double frand(void)
+static double_t frand(void)
{
unsigned long nRandInt;
@@ -205,7 +205,7 @@ static double frand(void)
g_nRandInt1 = nRandInt;
/* Construct an floating point value in the range from 0.0 up to 1.0 */
- return ((double)nRandInt) / ((double)RND_CONSTP);
+ return ((double_t)nRandInt) / ((double_t)RND_CONSTP);
} /* end frand */
#endif