Question to FLEXC:: rand() [solved]

Hi forumist's,
I'm an user of fastspin/FLEXC
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.3 Compiled on: Jun 29 2020
In stdlib.h I found
#define RAND_MAX 0x7fff
I make tests i.e.
I get values larger than 0x7FFF.
For a project I need a float random number. So I want to make a way similar this: (float) (rand() / RAND_MAX)
but therefore I need to know the max. Number delivered by rand().
Has anyone an idea ?
I'm an user of fastspin/FLEXC
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.3 Compiled on: Jun 29 2020
In stdlib.h I found
#define RAND_MAX 0x7fff
I make tests i.e.
int z = rand(); printf("%d \n",z);
I get values larger than 0x7FFF.
For a project I need a float random number. So I want to make a way similar this: (float) (rand() / RAND_MAX)
but therefore I need to know the max. Number delivered by rand().
Has anyone an idea ?
Comments
The randfloat() function is exact what I need.
In the meantime I do this workaround:
best regards
Reinhard