|
Page 1 of 1
|
[ 11 posts ] |
|
1.38: randomize, srand: bad help and not ANSI compatible
| Author |
Message |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
 1.38: randomize, srand: bad help and not ANSI compatible
there is still not enough help by code snippets and examples.
If I'm looking for srand and random, you should only have to put the cursor on this keyword in the source, and then press F1.
Then there should be a window with explanations and small code snippets, how to use each command and which variables have to be declarated.
One key word - One Page.
e.g. srand (seed): what is seed? I don't find anything!
A link to a related page ("more code examples") with extended and bigger source code examples may illustrate the usage. This might be a link to a sample program. for example.
Further on there should be a link from e.g. srand to random (and back) ("related functions"), where the other function is explained by examples ("close relatives").
Functions which are not similar or close to random and srand in any case should not be visible here at all (e.g., sin, cos, abs).
But another Link should guide to a page where an overview on a "distant relatives group" is listed (other math functions, hierarchical architecture).
By this system the Borland C++ or Delphi Help works excellent and is exemplary ! Maybe you wish to have a close look on this... 
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
Last edited by Ford Prefect on Fri Jul 25, 2008 3:54 pm, edited 5 times in total.
|
| Wed Jun 11, 2008 6:28 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
I appreciate your input, but I need to remind you that Borland has hundreds of people working on their project, some specifically only on the help platform. We have 2 who work on everything.
The help is a significant upgrade over what was there. I wouldn't expect anything to the level of a professional development environment any time in the near future. Most of those help systems are custom developed whereas our help system is based off of windows-standard CHM/HTML based help.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Thu Jun 12, 2008 11:45 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
aaaahhhm...ok..
but could you plz explain the usage of
srand (seed): what is seed?
and for random there should be a usage with a REAL argument as well (not only INTEGER), in order to get a float value between 0...1
EDIT: sorry, random was a PASCAL command, not the C command .
the C command is rand(), but about rand() I can't find anything in the RobotC Help.
I still can't find anything about that...
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
Last edited by Ford Prefect on Fri Jun 20, 2008 6:36 am, edited 2 times in total.
|
| Fri Jun 13, 2008 6:08 am |
|
 |
|
starwarslegokid
Moderator
Joined: Wed Jan 31, 2007 3:39 am Posts: 298 Location: San Diego, California. USA
|
Seed is any whole number, it is used to decide where on a random number list the computer/nxt should start getting random numbers from. Computers have one huge list of random numbers and the seed is where the computer should start from. Its ironic really, that random numbers come from a predefined unchanging list lol, thats what the seed is for, so you can start in a different spot on the list. The list is huge, pages on pages, but sometimes its nice to know how the computer is really getting these "random" numbers. Thats the fun fact for the day lol B-)
Scott
_________________Mmmm Legos B-) My Robot Projects: http://www.freewebs.com/robotprojects/
|
| Wed Jun 18, 2008 4:04 pm |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
hi,
thx for this.
So srand(10) causes a different series of randomized numbers than srand(99).
So far so good.
But if I'll start in my program each time with the same randomization seed command, e.g.
srand(99),
won't the random function always produce the same series of random numbers, just if I hadn't called it ever at all?
Or is there a difference in the series, although the "seed " always is 99 ?(maybe, RobotC is the actaual date and time automatically to 99 as kind of variables ?)
In ANSI C this is not working automatically, here you have to initialize srand by sort of srand(time(0)) to get different series each time.
So, again:
what is seed needed for as a constant value in a routine, because from any runtime to any runtime there will be always 1 identical constant seed that leads to the identical series of pseudo random numbers ever and ever?
Is there a RobotC time function which you may use in order to get always different seeds from any runtime to the next?
Get what I mean?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
Last edited by Ford Prefect on Fri Jun 20, 2008 6:41 am, edited 6 times in total.
|
| Thu Jun 19, 2008 3:13 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
BTW:
Because this ROBOTC keyword random() reminded me more on Pascal than on C, I've been searching for some ANSI C definitions.
Here is what I found:
In ANSI C there is a function rand (NOT random), which produces random numbers between 0...RAND_MAX:
why is RobotC in this point - again - different to ANSI C?
These special ROBOTC fantasy keywords make me really angry - how can one transfer any RobotC file to a standard ANSI C compiler (or reverse), if RobotC doesn't keep the standards??
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Thu Jun 19, 2008 6:37 am |
|
 |
|
posterus
Rookie
Joined: Fri May 30, 2008 2:08 pm Posts: 5
|
Hi Ford,
Sometimes you need a random series of numbers but you need that this series to be reproducible. The seed allows you to reproduce this series. I work with optimization algorithms for planning and scheduling the production of steel plants and this is a required feature for the algorithms that I use. I want to output the same result every time the user runs our programs with the same data.
If you want a different series of numbers each time that you run your program, just use the variable nSysTime as a seed.
|
| Fri Jun 20, 2008 8:02 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
hi,
that's a good reason - and a good idea, thanks a lot!
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Fri Jun 20, 2008 8:19 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
@dick swan, @tfriez,
could you plz give a statement to these problems?
thx in advance!
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Tue Jul 08, 2008 2:45 am |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
The help documentation will be improved for the final release version of 1.40
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Wed Jul 09, 2008 10:45 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
 Re: 1.38: randomize, srand: bad help and not ANSI compatible
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Wed Aug 20, 2008 12:54 pm |
|
|
|
Page 1 of 1
|
[ 11 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 4 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|