![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: real random() function in DOORS 7.1 Topic Summary: Is the real random() function buggy in 7.1 ? Created On: 11-Jul-2006 09:37 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Greetings,
the appended trivial DXL script (in DOORS 7.1) generates indeed 1000 real numbers for me, but with an average of 0.000007765, and a maximum of 0.000015.
Now, technically this is 0 <= x < 1 as advertised in the doc.s, but it can't be right...
Am I missing something here, or is it a known issue?
(BTW, int random(N) works fine, generating numbers between 0 and N.)
Thanks for any pointers.
Cheers,
Martin
Edited: 11-Jul-2006 at 09:42 by Martin Erdelen |
|
![]() |
|
![]() |
|
Never dealt with Real numbers before. I get only 6 digits after the decimal point with the attached modification of your script, last line is this:
Min-Max-Average = 0.000000 0.000015 0.000008 How did you get more precision? - Louie |
|
![]() |
|
![]() |
|
Thanks for your reply.
The random numbers themselves did have 6 digits after the decimal point, same as for you. But I then transferred them to Excel and calculated the average there (to keep the DXL script as simple as possible); that's why the average has more decimal digits. But I think for a (uniform) random distribution of real numbers 0 <= x < 1, the average should actually be 0.5, and the maximum 0.999999 (give or take a bit according to sample size and chance). Or? Martin Edited: 12-Jul-2006 at 06:48 by Martin Erdelen |
|
![]() |
|
![]() |
|
just use something like
r *= 10000.0 to get a higher precision with r *= 10000000.0 while(r > 10.0) r -= 10.0 //makes it all a bit faster while(r > 1.0) r -= 1.0 you get a "good" randomfunction for real-numbers between 0 and 1, though the last 7 digits are not really random. Min-Max-Average = 0.001385 0.999468 0.495007 Edited: 12-Jul-2006 at 08:11 by Michael Werner |
|
![]() |
|
![]() |
|
I agree, it looks broken to me. It doesn't do what it says on the tin!
But the attached works for me... ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive |
|
![]() |
|
![]() |
|
Martin,
For integer random numbers, the maximum that will be generated will be 32768, no matter what parameter you run the random() function with. I confirmed this with Telelogic support. I'm not sure if this relates in any to the behavior you are seeing. ------------------------- Michael Sutherland michael@galactic-solutions.com http://galactic-solutions.com |
|
![]() |
|
![]() |
|
I personnaly use this "quick and dirty" generator, taken from ISO/IEC 9899 (C language).
It generates integers between 0 and 65535, and at least I know how it works. ------------------------- E. Piallat CeBeNetwork Edited: 3-Aug-2006 at 18:16 by Eric Piallat |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
real random() function in DOORS 7.1
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.