random numbers 
Author Message
 random numbers

I try to pick up some random numbers ...
so I wrote a procedure ...

it produced differents numbers when i ran it inside the vfp.
but it didnt when it ran as a .exe file ...

anyone can resolve this??

thank you



Fri, 16 Dec 2005 16:45:26 GMT  
 random numbers
Hello, finns!
You wrote  on Mon, 30 Jun 2003 16:45:26 +0800:

 f> it produced differents numbers when i ran it inside the vfp.
 f> but it didnt when it ran as a .exe file ...

I think you need to share your code otherwise we can not help you fixing
your problem.
Are you using the RAND() function?
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Fri, 16 Dec 2005 17:37:30 GMT  
 random numbers

Quote:

> I try to pick up some random numbers ...
> so I wrote a procedure ...
> it produced differents numbers when i ran it inside the vfp.
> but it didnt when it ran as a .exe file ...

Read the documentation of the RAND() function. If you look at it, you see
that RAND(-1) gives you a random seed for the RAND function.


Fri, 16 Dec 2005 17:59:35 GMT  
 random numbers
The definition of "random" means that the numbers will be different every
time you run the code. Why did you expect the numbers to be the same?

--
Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP


Quote:
> I try to pick up some random numbers ...
> so I wrote a procedure ...

> it produced differents numbers when i ran it inside the vfp.
> but it didnt when it ran as a .exe file ...



Fri, 16 Dec 2005 20:52:39 GMT  
 random numbers
Hi Finns:

Try compiling this code into a simple executable and see if it works:

136420 How to Create an Array of Unique Random Numbers
http://support.microsoft.com/?id=136420

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
   http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
   http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
   - VFP5 Mainstream Support retires June 30th, 2003
   - VFP6 Mainstream Support retires Sept. 30th, 2003

Quote:
> I try to pick up some random numbers ...
> so I wrote a procedure ...

> it produced differents numbers when i ran it inside the vfp.
> but it didnt when it ran as a .exe file ...



Fri, 16 Dec 2005 22:14:06 GMT  
 random numbers

Quote:

> The definition of "random" means that the numbers will be different every
> time you run the code. Why did you expect the numbers to be the same?

If you use RAND() without seeding it, the numbers turn always up the same
in VFP. There are not much true random number generators. Most of them
aren't random at all. They are calculated (don't ask me what the formula is
for VFP). The only important thing is that there are several tests for
checking if a list of numbers is random. And hopefully the algorithm that
is used for generating the numbers passes those tests as much as possible.
So if you write application in which random numbers play an important part,
then it is better to know which algorithm is used for generating the
numbers.
--
Groetjes,
   Wim.


Sat, 17 Dec 2005 14:41:34 GMT  
 random numbers

Quote:

> 136420 How to Create an Array of Unique Random Numbers
> http://support.microsoft.com/?id=136420

One very important omission in this article is the fact that there is no
mentioning of the fact that you must seed the randomnumber generation by
issuing in RAND(-1) (or another negative value). Read very carefully the
help file about the RAND() function.

And another thing (that is very hard to confirm) be aware of the fact that
RAND() gives you a number between 0 and 1, but sometimes it is 0 or 1. So
if you use code like 1 + INT(RAND() * AA) to get a number between 1 and AA,
you get sometimes AA + 1.

--
Groetjes,
   Wim.



Sat, 17 Dec 2005 14:48:34 GMT  
 random numbers
Ive been too lazy to read the other replys, so some one
may have suggested this.
if you supply a negative number for a seed, then the seed
is taken from the system clock, so is different each time.

EG myval=RAND(-4)

Quote:
>-----Original Message-----
>I try to pick up some random numbers ...
>so I wrote a procedure ...

>it produced differents numbers when i ran it inside the
vfp.
>but it didnt when it ran as a .exe file ...

>anyone can resolve this??

>thank you

>.



Tue, 20 Dec 2005 19:01:15 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. random numbers not random

2. I need to build a random number access

3. random number

4. Random Numbers ??

5. Random Number Generator

6. Random Numbers

7. random numbers

8. Random numbers

9. Help w/ Random Numbers???????

10. Random number?

11. Random number b/w specific values

12. Help, with Random Numbers

 

 
Powered by phpBB® Forum Software