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.

Randomizing Linked list addresses

Status
Not open for further replies.

kaushikrvs

Member level 5
Joined
Jan 27, 2017
Messages
82
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
613
My malloc is allocating consecutive addresses. I want my linked list next address to be a random address instead of consecutive addresses. I know malloc is hard to control; so i wanted to know how to randomize the pointers in the linkedlist? For exxample ; if link1->next = 0xf8 ; link2->next = oxf9; link3->next = 0xf9; I want to make link1->next = 0xf8 ; link2->next = oxfa ; link3->next = 0xf9
 

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
14,179
Helped
2,807
Reputation
5,622
Reaction score
2,744
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
105,769
One easy trick to obtain random numbers is to grab the contents of a byte of ram which changes continuously. Example, internal time clock.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,152
Helped
4,943
Reputation
9,907
Reaction score
4,754
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,689
Methods to generate random numbers is one thing but what is the purpose of randomizing the links in a linked list? Surely, the whole point of a linked list is that each entry points the the next in sequence anyway, no matter what address the link actually points to.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top