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.

gordon the light

Newbie level 4
Newbie level 4
Joined
Feb 13, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
I have a problem with the random number generator function with MPLAB c programming.
We use rand() to generate 2 numbers, but the 1st number is generated randomly in odd sequence and the other number is generated randomly in even sequence. The number is from 0-7. This is our code:



i=rand();
startcount=i%8;

j=rand();
lastcount=j%8;
 

Hi, you might want to see this!

https://www.phanderson.com/PIC/16C84/random.html

- - - Updated - - -

HellO!

you might want to know this for more.

http://search.edaboard.com/pic%20shift%20register.html
https://www.edaboard.com/threads/166747/
http://www.microchip.com/forums/tt.aspx?forumid=-2
 
  • Like
Reactions: poop911

    poop911

    Points: 2
    Helpful Answer Positive Rating
Er... can give sample codes please? Thanks
 

I tried to use timer0 to create the random generator.
But not sure how to can someone give me a sample code? Thanks, it would be a great help.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top