Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 19th, 2006, 4:38 AM   #1
Markphaser
Newbie
 
Join Date: Feb 2006
Posts: 28
Rep Power: 0 Markphaser is an unknown quantity at this point
time Delays and Random functions

How do i write Time delay functions or instructions?

Like Delay for 40us or 80ms?

But how do i make them "overlap" if i had multiple time delays going on?

How do u modify or manipulate the random function?

Where can i get external random function librarys or librarys that have different random functions?

Each programming language has different random functions that are different ways of getting a random generator how do i call different programming language librarys please?
Markphaser is offline   Reply With Quote
Old Feb 19th, 2006, 12:03 PM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Maybe you should read this.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Feb 19th, 2006, 4:25 PM   #3
Markphaser
Newbie
 
Join Date: Feb 2006
Posts: 28
Rep Power: 0 Markphaser is an unknown quantity at this point
How do i set the "random seed" To get different random number sequences?

What sets the random number sequences like how to i change the "order" of the "number sequence"?

How do u change the current time at program's startup?

Why is the sequence is different at each startup?

How do u change the returns a random value in range?
Markphaser is offline   Reply With Quote
Old Feb 20th, 2006, 3:12 AM   #4
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Make a call to srand.
What order?
Look at <ctime> functions and make an OS API call.
What sequence?
Change what?
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Feb 20th, 2006, 7:52 AM   #5
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
#include <ctime>
int Rand(int num);
int Rand(int num)
{
    unsigned int _time = time(NULL);
    srand(_time);
    return (int) rand() % num;
}
you can try that
Master is offline   Reply With Quote
Old Feb 20th, 2006, 2:53 PM   #6
Markphaser
Newbie
 
Join Date: Feb 2006
Posts: 28
Rep Power: 0 Markphaser is an unknown quantity at this point
How to change the sequence order?
How to change the random order?

Why make a OS API call?

How do i call external librarys that have random functions please?

How do i call external programming languages functions that have
different random functions please?
Markphaser is offline   Reply With Quote
Old Feb 20th, 2006, 4:01 PM   #7
Markphaser
Newbie
 
Join Date: Feb 2006
Posts: 28
Rep Power: 0 Markphaser is an unknown quantity at this point
What is the theory behind random generators?

How can i make a random generator by scratch and manually
make one from ground up please?

The Random function is controlled by a Timing clock?
Markphaser is offline   Reply With Quote
Old Feb 20th, 2006, 4:23 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
G . O . O . G . L . E
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 20th, 2006, 4:41 PM   #9
Markphaser
Newbie
 
Join Date: Feb 2006
Posts: 28
Rep Power: 0 Markphaser is an unknown quantity at this point
Yes google is good but can u help me also
Markphaser is offline   Reply With Quote
Old Feb 20th, 2006, 4:48 PM   #10
Markphaser
Newbie
 
Join Date: Feb 2006
Posts: 28
Rep Power: 0 Markphaser is an unknown quantity at this point
Where can u get different seeds?
or can u make up seeds from scratch?

The seed generates the psudeo random number?

Which clocks?

What is a "pid" please?

""something non-constant is probably best so that its not something you can guess and get the exact same results every time.""

Can u please give examples
Markphaser is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC