I have a dbf with some record and I must take a record from this archive but on randomize
How I can make ?
RANDOMIZE
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
RANDOMIZE
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: RANDOMIZE
Select YOURDBF
DbGoTo( nRandom(LastRec()-1)+1 )
nRandom is 0 to nParam
LastRec() is your total recs
You need the -1 on LastRec to compensate the 0 start from nRandom and the +1 is to compensate the -1
DbGoTo( nRandom(LastRec()-1)+1 )
nRandom is 0 to nParam
LastRec() is your total recs
You need the -1 on LastRec to compensate the 0 start from nRandom and the +1 is to compensate the -1
Email: SamirSSabreu@gmail.com
MSN: SamirAbreu@hotmail.com
Skype: SamirAbreu
xHarbour 1.1.0 + FwXh 8.02
xHarbour 1.2.1 + Fwhh 10.6
MSN: SamirAbreu@hotmail.com
Skype: SamirAbreu
xHarbour 1.1.0 + FwXh 8.02
xHarbour 1.2.1 + Fwhh 10.6
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: RANDOMIZE
NRANDOM HAVE PROBLEM
i REMEMBER THERE WAS ANOTHER WITH HB_
i REMEMBER THERE WAS ANOTHER WITH HB_
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: RANDOMIZE
I never had a problem with nRandom, but...
DbGoTo( HB_Random(1, LastRec() ) ) should solve too.
DbGoTo( HB_Random(1, LastRec() ) ) should solve too.
Email: SamirSSabreu@gmail.com
MSN: SamirAbreu@hotmail.com
Skype: SamirAbreu
xHarbour 1.1.0 + FwXh 8.02
xHarbour 1.2.1 + Fwhh 10.6
MSN: SamirAbreu@hotmail.com
Skype: SamirAbreu
xHarbour 1.1.0 + FwXh 8.02
xHarbour 1.2.1 + Fwhh 10.6
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: RANDOMIZE
I think you are going to need to convert the values to integers.
And, I assume for what you want you will need to generate an array so you can check for duplicates and not add them. You are looking to create an array of unique values.
James
And, I assume for what you want you will need to generate an array so you can check for duplicates and not add them. You are looking to create an array of unique values.
James