Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Random number generator

Status
Not open for further replies.

djc

Advanced Member level 1
Advanced Member level 1
Joined
Jan 27, 2013
Messages
402
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
India
Visit site
Activity points
4,554
Hi all,

Can any body plz give me code to generate 4 digit random number which should not be repeated if appear once until all 9998 combinations. Code should run in KEIL for ARM. I wrote one with 'randomize ()' and random function which is giving an error in KEIL.
Plz guide.
 

hi,

I came to know about one logic. In my project i am using mobile no. Its 10 digit no. Now if i divide this no by some 7 digit no then i will get 4 digit no that will be the random no. Now issue is the function which is sending data to GSM is taking unsigned char data then how to declare the mobile no and other 7 digit no which will divide the 10 digit mobile no. Means what should be the datatype? Do i have to take an array for both the numbers ? can i divide numbers in an array ? if not then how to divide them?
 

Hi,

Sorry to trouble you again, But can you plz tell me how to convert whole 4 digit no in unsigned char array? Do i have to separate the digits and store them in an array? Or any other method i have to employ?
 

Hi,

its good to hear that you are thinking. Once you got a number whether it is signed or unsigned use sprintf function to convert that to an array. An example is given here
HTML:
http://www.cplusplus.com/reference/cstdio/sprintf/
. I hope this helps.

enjoy!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top