Commit e2c34640 authored by fischer's avatar fischer
Browse files

CAM: f_random imported from LibItsCommon

GEOnet modified for media independent
parent 5dbc891e
Loading
Loading
Loading
Loading
+4 −23
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@ module LibItsCam_Functions {
	import from LibItsCam_Templates all;
	import from LibItsCam_Templates all;
	import from LibItsCam_Pixits all;
	import from LibItsCam_Pixits all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCommon_Functions all;
	import from CAM_PDU_Descriptions language "ASN.1:1997" all;
	import from CAM_PDU_Descriptions language "ASN.1:1997" all;
	import from DENM_PDU_Descriptions language "ASN.1:1997" all;	
	import from DENM_PDU_Descriptions language "ASN.1:1997" all;	
 
 
@@ -79,28 +80,8 @@ group postambles {


group otherFunctions {
group otherFunctions {
        
        
	/** @desc	function to generate integer random values
	 *			
	 * @see		ttcn-3 - rnd()
	 *  @param 	p_lowerbound lowest number in range<br>
	 *  @param 	p_upperbound highest number in range<br>
	 *  @return 	integer<br>
	 *
	*/
	function f_random(	in integer p_lowerbound,
    					in integer p_upperbound )
	return integer {
		//Variables
		var integer v_random := 0;
        v_random := float2int(int2float(p_upperbound - p_lowerbound +1)*rnd()) + p_lowerbound;
		//  Here, upperbound and lowerbound denote highest and lowest number in range.
		log("*** f_random: INFO: OK - random value = " & int2str(v_random) & " ***");
        return v_random;

	} // end function f_random

	/** @desc	function to generate a random bitstring value 
	/** @desc	function to generate a random bitstring value 
	 * 			corrzesponding to 1 bit position set to 1 (eg '00010000', '01000000', ...)
	 * 			corresponding to 1 bit position set to 1 (eg '00010000', '01000000', ...)
	 *			
	 *			
	 *  @see	f_random
	 *  @see	f_random
	 *  @param 	p_length bitstring length - max 15<br>
	 *  @param 	p_length bitstring length - max 15<br>
@@ -113,10 +94,10 @@ group otherFunctions {
		var bitstring v_random := '00000000'B;
		var bitstring v_random := '00000000'B;
		
		
        v_random := '000000000000001'B << f_random (0, p_length);
        v_random := '000000000000001'B << f_random (0, p_length);
		log("*** f_random: INFO: OK - random value = " & bit2str(v_random) & " ***");
		log("*** f_bitPositionRandom: INFO: OK - random value = " & bit2str(v_random) & " ***");
        return v_random;
        return v_random;


	} // end function f_random
	} // end function f_bitPositionRandom


} // end group otherFunctions
} // end group otherFunctions


+0 −2
Original line number Original line Diff line number Diff line
@@ -8,8 +8,6 @@
module LibItsCommon_Functions {
module LibItsCommon_Functions {






	/** @desc	function to generate integer random values
	/** @desc	function to generate integer random values
	 *			
	 *			
	 * @see		ttcn-3 - rnd()
	 * @see		ttcn-3 - rnd()
+10 −0
Original line number Original line Diff line number Diff line
@@ -1098,6 +1098,16 @@ module LibItsGeoNetworking_Functions {
            return v_itsGnLifetimeLocTE;
            return v_itsGnLifetimeLocTE;
        } // end f_getLifetimeLocTE
        } // end f_getLifetimeLocTE
        
        
        /**
         * @desc Set the number of neighbour in the Location Table.
         * @return 
         */        
        function f_setNrNeighbourLT(in integer p_nrNeighbour) runs on ItsNt {
            
            //TODO set the number of Nieghbour in the IUT Location Table
            
        } // end f_setNrNeighbourLT
        
    } // end iutFunctions
    } // end iutFunctions
    
    
    group posVectorFunctions {
    group posVectorFunctions {