Search found 38 matches: nrandom

Return to advanced search

Re: nRandom Numbers no duplicates

... RANDOM SIN DUPLICADOS//------------------------------------------------//Function NumRandomNoDuplic()  local n := 0, nLen := 10, nRandom, aRandom := {}  While n < nLen     nRandom := HB_RandomInt(nLen)     if AScan( aRandom, ...
by FranciscoA
Tue Dec 07, 2021 6:25 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: nRandom Numbers no duplicates
Replies: 4
Views: 353

Re: nRandom Numbers no duplicates

FUNCTION RandomList( nNum )   LOCAL aList := ARRAY( nNum )    LOCAL nAt, aRandom := {}   AEval( aList, { | u, i | aList[ i ] := 0 } )   DO WHILE LEN( aRandom ) < nNum      nAt := HB_RandomInt( 1, nNum )      DO WHILE aList[ ...
by Marcelo Via Giglio
Tue Dec 07, 2021 6:11 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: nRandom Numbers no duplicates
Replies: 4
Views: 353

Re: nRandom Numbers no duplicates

// \samples\RANDOM2.PRG#include "FiveWin.ch"STATIC aNumerosFUNCTION RandomList()   LOCAL cTexto := ""   LOCAL cFile  :=  "numeros.txt"   LOCAL nSort   // aqui inicia o sorteio considerando o range de 1 até 100&n...
by karinha
Tue Dec 07, 2021 3:48 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: nRandom Numbers no duplicates
Replies: 4
Views: 353

Re: nRandom Numbers no duplicates

Mira se ayuda: // \samples\RANDOM1.PRG#Include "FiveWin.ch"FUNCTION RandomList()   LOCAL aList := ARRAY( 100 ) // 999999   LOCAL nAt, aRandom := {}   AEval( aList, { | u, i | aList[ i ] := i } )   W...
by karinha
Tue Dec 07, 2021 3:41 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: nRandom Numbers no duplicates
Replies: 4
Views: 353

nRandom Numbers no duplicates

I have to calculate a random number up to 1 10
I have to extract 1 at a time for 10 times and I don't have to extract a number that has already been extracted, what should I do?

num:=nRandom(10)


Image

I tried but I get duplicates what should I do?
by Silvio.Falconi
Tue Dec 07, 2021 1:07 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: nRandom Numbers no duplicates
Replies: 4
Views: 353

Funções "RANDOM" não funcionam!

Fiz vários testes com nRANDOM(), RANDOM(), HB_RandomInt(), etc e todas elas NÃO FUNCIONARAM nas suas totalidades ou seja, todas deixaram de fornecer alguns números em uma de range 999999 e estou com muita dificuldade em encontrar uma ...
by Ladinilson
Fri Aug 07, 2020 1:41 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: Funções "RANDOM" não funcionam!
Replies: 4
Views: 550

Re: Sudoku with fwh

... easy select allways the same sudoku ( he learn how resolve it )... ahahahahh :) Instead I made another function : the procedure select a sudolu on nRandom... Function SudokuLoad(nLevel)  Local aLoadstring:= Load_File_Sudoku(nLevel)  Local nConteggioSudoku:=Len(aLoadstring)  ...
by Silvio.Falconi
Wed Jan 21, 2015 6:20 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: Sudoku with fwh
Replies: 28
Views: 8144

Re: >Colores por cada letra de un texto

... Light" SIZE 0, -18 hFont := SelectObject( hDC, oFont:hFont ) for n := 1 to nLen cLetra := substr( cTexto, n, 1 ) nColor := SetTextColor( hDC, nRandom( CLR_WHITE ) ) TextOut( hDC, 10, nLeft, cLetra ) SetTextColor( hDC, nColor ) nLeft += GetTextWidth( hDC, cLetra, oFont ) next SelectObject( ...
by pgfdz
Wed Aug 13, 2014 7:46 am
 
Forum: FiveWin para Harbour/xHarbour
Topic: >Colores por cada letra de un texto
Replies: 5
Views: 1107

Sustituir RPreview por Reader

... y le he añadido estas líneas a continuación del if oPrinter:lMeta del comienzo: oPrinter:cfile := GetEnv("TMP")+'\TMP'+alltrim(str(nRandom()))+'.pdf' do whil file(oPrinter:cfile) oPrinter:cfile := GetEnv("TMP")+'\TMP'+alltrim(str(nRandom()))+'.pdf' enddo Me funciona muy ...
by Sebastián Almirón
Wed May 21, 2014 5:20 pm
 
Forum: FiveWin para Harbour/xHarbour
Topic: Sustituir RPreview por Reader
Replies: 5
Views: 802

Re: CONSULTA URGENTE!!! RANDOM

Ozono, si en vez de nNum := nRandom( nRand ) escribes: nNum := nRandom( nRand )+1 te aseguras de que nunca te va a dar 0 y te quitas de complicaciones

Un saludo. Y suerte...
by antolin
Fri Oct 25, 2013 10:44 am
 
Forum: FiveWin para Harbour/xHarbour
Topic: CONSULTA URGENTE!!! RANDOM
Replies: 7
Views: 1694

Re: CONSULTA URGENTE!!! RANDOM

... es lo que estás preguntando. Supongo que necesitas generar un número aleatorio para tu división en partes desiguales. Para ello está la función nRandom(x) que genera un número aleatoio entre 0 y x. Por ejemplo: nNum := nRandom(10) Genera un número entre 0 y 10. Si lo que quieres es, ...
by antolin
Tue Oct 22, 2013 6:56 am
 
Forum: FiveWin para Harbour/xHarbour
Topic: CONSULTA URGENTE!!! RANDOM
Replies: 7
Views: 1694

Re: RANDOMIZE

I never had a problem with nRandom, but...

DbGoTo( HB_Random(1, LastRec() ) ) should solve too.
by sambomb
Thu Jan 31, 2013 1:42 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: RANDOMIZE
Replies: 5
Views: 748

Re: RANDOMIZE

NRANDOM HAVE PROBLEM
i REMEMBER THERE WAS ANOTHER WITH HB_
by Silvio.Falconi
Thu Jan 31, 2013 12:48 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: RANDOMIZE
Replies: 5
Views: 748

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
by sambomb
Thu Jan 31, 2013 10:49 am
 
Forum: FiveWin for Harbour/xHarbour
Topic: RANDOMIZE
Replies: 5
Views: 748

Re: Unas preguntas sobre TGraph

Fernando, yo lo hago asi: Cargo mis valores: oGra:AddSerie(aCant,cVar,nRGB(nRandom(254),nRandom(254),nRandom(254))) //nRGB(106,130,218)) oGra:SetYVals(aDia) cuando cambio valores hago esto: inicializo oGra:aSeries :={} oGra:aData := {} oGra:aSTemp := {} oGra:aDTemp ...
by Francisco Horta
Tue Aug 02, 2011 9:46 pm
 
Forum: FiveWin para Harbour/xHarbour
Topic: Unas preguntas sobre TGraph
Replies: 1
Views: 456
Next

Return to advanced search