NetSim Source Code Help
Loading...
Searching...
No Matches
RandomNumber.c
Go to the documentation of this file.
1/************************************************************************************
2 * Copyright (C) 2020 *
3 * TETCOS, Bangalore. India *
4 * *
5 * Tetcos owns the intellectual property rights in the Product and its content. *
6 * The copying, redistribution, reselling or publication of any or all of the *
7 * Product or its content without express prior written consent of Tetcos is *
8 * prohibited. Ownership and / or any other right relating to the software and all *
9 * intellectual property rights therein shall remain at all times with Tetcos. *
10 * *
11 * Author: Shashi Kant Suman *
12 * *
13 * ---------------------------------------------------------------------------------*/
14
15 #ifndef _WIN32
16 #include "Linux.h"
17 #endif
18/** This function is used to generate the random number */
19_declspec(dllexport) int fnRandomNo(long lm, double *fRandNo, unsigned long *uSeed,unsigned long *uSeed1)
20{
21 long ldTemp;
22 double fy = 0;
23 *uSeed
24 = (unsigned long) ((40014 * (*uSeed))
25 % (unsigned long) (2147483563));
26 *uSeed1 = (unsigned long) ((40692 * (*uSeed1))
27 % (unsigned long) (2147483399));
28 ldTemp = (long) ((*uSeed - *uSeed1) % (long) (2147483562));
29 if (ldTemp != 0) {
30 fy = (double) ((double) (ldTemp) / (double) (2147483563));
31 } else {
32 fy = (double) ((double) (2147483562) / (double) (2147483563));
33 }
34 *fRandNo = fy;
35 return 1;
36}
37
38
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
int fnRandomNo(long lm, double *fRandNo, unsigned long *uSeed, unsigned long *uSeed1)
Definition: RandomNumber.c:19