Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

help needed: srand48() & lrand48()

Status
Not open for further replies.

msim

Newbie level 6
Joined
Sep 17, 2002
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
18
srand48() & lrand48() are standard c/c++ functions to produce pseudo random data. but for some reasons, my 32 bits machine and the compiler only support srand() & lrand(); and I need to create srand48() and lrand48() in c (with basic stdlib.h) or assembly language. could anyone please help me out: how to create those two functions. thanks.
 

Antharax

Full Member level 4
Joined
Dec 31, 1999
Messages
208
Helped
14
Reputation
28
Reaction score
1
Trophy points
1,298
Activity points
2,865
They are NOT standard C functions!
This means the creator of the compiler is not obligated to implement these

Microsoft didn't implement them in visual C++!

What operating system are you using?
I find man pages about them on unix systems (not sure about linux).
Perhaps you could consult the linux kernel sources or gcc sources for implementation
or search on the net

Antharax
 

Ace-X

Advanced Member level 2
Joined
Jan 25, 2002
Messages
529
Helped
41
Reputation
82
Reaction score
14
Trophy points
1,298
Location
Germany
Activity points
5,150
msim,
You can simply use any pseudo-random number generator [PRNG] to implement functions like these with any size of generated numbers. Look on Internet for keywords "pseudo random generator".
For example, here is the first site I found with C sources: http://www.agner.org/random/

Ace-X.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top