Sign in to follow this  
Followers 0
mohi

generate number by const number

2 posts in this topic

hi

i  wont to ask about something can i know the role of generation number by some numbers are generated i mean i know numbers i wont the role of generation

and what is the ip in the plc

 

 

thanks

Share this post


Link to post
Share on other sites

int intrnd (int& seed)
{

#if LONG_MAX > (16807*2147483647)

int const a    = 16807;      
int const m    = 2147483647;     
seed = (long(seed * a))%m;
 return seed;

#else

double const a    = 16807;      
double const m    = 2147483647; 
double temp = seed * a;
seed = (int) (temp - m * floor ( temp / m ));

return seed;

#endif

}
 

I Hope this code is beneficial for you and if you want to more details about PLC Programming so you can visit my link

Thanks and Best Regard

Visit Link:- 

http://www.cetpainfotech.com/technology/plc-and-scada-training

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0