Skip to content
Snippets Groups Projects
Commit 535ff4d1 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Resolved bug on random values for delay in generated CPOSIX code / AVATAR

parent f2b48452
No related branches found
No related tags found
No related merge requests found
SRCS = generated_src/main.c generated_src/TestBench.c generated_src/SpeedSensor.c generated_src/RadarSensor.c generated_src/GPSSensor.c generated_src/CarPositionSimulator.c generated_src/EmergencySimulator.c generated_src/Communication.c generated_src/DSRSC_Management.c generated_src/NeighbourhoodTableManagement.c generated_src/CorrectnessChecking.c generated_src/PTC.c generated_src/DrivingPowerReductionStrategy.c generated_src/BCU.c generated_src/DangerAvoidanceStrategy.c generated_src/BrakeManagement.c generated_src/CSCU.c generated_src/ObjectListManagement.c generated_src/PlausibilityCheck.c generated_src/VehiculeDynamicsManagement.c
\ No newline at end of file
SRCS = generated_src/main.c generated_src/Block0.c generated_src/Block2.c generated_src/Block1.c
\ No newline at end of file
......@@ -90,8 +90,11 @@ void waitFor(long minDelay, long maxDelay) {
struct timespec tsret;
int delay;
debugMsg("Computing random");
debugMsg("Computing random delay");
//debugLong("Min delay", minDelay);
//debugLong("Max delay", maxDelay);
delay = computeLongRandom(minDelay, maxDelay);
debugLong("Random delay=", delay);
......
......@@ -23,13 +23,14 @@ long computeLongRandom(long min, long max) {
return min;
}
long rand0 = (((long)(rand()))*powl(2, ((((sizeof(long)-2))*8)-1)));
long rand0 = (long)rand();
long rand1 = rand0 % (max - min);
//debugLong("min=", min);
//debugLong("max=", max);
//debugLong("rand0", rand0);
//debugLong("rand1", rand1);
debugLong("Random long", rand1 + min);
//debugLong("rand1", rand1);
//debugLong("Random long", rand1 + min);
return rand1 + min;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment