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.

Randomizing Linked list addresses

Status
Not open for further replies.

kaushikrvs

Member level 5
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
Advanced Member level 7
Joined
Apr 1, 2011
Messages
14,806
Helped
2,878
Reputation
5,768
Reaction score
2,901
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
110,642
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
Advanced Member level 7
Joined
Jul 4, 2009
Messages
15,846
Helped
5,093
Reputation
10,211
Reaction score
4,960
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
134,155
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