Jump to content


Photo

Obter Um Numero Aleatorio Entre 1 à 1000


  • Faça o login para participar
17 replies to this topic

#1 Hospedar-se .Com

Hospedar-se .Com

    Super Veterano

  • Usuários
  • 1500 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 26/02/2005, 00:25

Alguem sabe como faço pra escolher um número aleatório inteiro entre 1 e 1000?

por exemplo, uma hora ele escolhe o numero 237, outra hora o 336 etc...

#2 LucasMS

LucasMS

    Super Veterano

  • Usuários
  • 2076 posts
  • Sexo:Não informado

Posted 26/02/2005, 09:04

CGI eu num sei nada, mas sei PHP, que veio do perl/cgi (muito parecidos). entao deve ter uma funcao RAND(1,1000) que retorne esse numero

#3 Whitesnake

Whitesnake
  • Visitantes

Posted 26/02/2005, 14:23

No Perl é quase isso... o correto seria só rand(1000)....
Caso queira retornar em valor inteiro aí seria int rand(1000)

Flw.

#4 prix

prix

    Duracell: E Duram, Duram, Duram...

  • Usuários
  • 562 posts
  • Sexo:Não informado
  • Interesses:keep walking ...
    jonny walker

Posted 27/02/2005, 02:16

$valor = int(rand(1000));
tb pode por entre parenteses hehe inutil neh ...

print join'',(reverse  map{/d([a-z])d/}split/W/,'$5x6@314&60f%3i4#moo^1r2#moo^1p2')," ", pack ("B*",'01110000011001010111001001101100')," ", pack ("B*",'011011010110111101101110011010110110010101111001'), "n";
sleep 5;


E-Mails, topicos ou mensagens privadas não serão respondidas a menos que eu considere uma relevancia/necessidade na mesma.

#5 Hospedar-se .Com

Hospedar-se .Com

    Super Veterano

  • Usuários
  • 1500 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 27/02/2005, 03:53

valeu

To fazendo um sistema de banner, ai fiquei meio na duvida, pq ele só pegava os quebrados ... 3.5 algo assim

#6 Whitesnake

Whitesnake
  • Visitantes

Posted 27/02/2005, 12:26

Agora para gerar um número aleatório entre 50 e 100 por exemplo ficaria assim:

$a=50; #Número mínimo
$b=100; #Número máximo

$n=int rand($B);

while ($n < $a){
$n=int rand($B);
}

Ou seja ele vai ficar gerando número até que este seja menor que 50, mas como o processamento é rápido nem se percebe! ;) hehehe

Flw

#7 prix

prix

    Duracell: E Duram, Duram, Duram...

  • Usuários
  • 562 posts
  • Sexo:Não informado
  • Interesses:keep walking ...
    jonny walker

Posted 27/02/2005, 16:57

valeu

To fazendo um sistema de banner, ai fiquei meio na duvida, pq ele só pegava os quebrados ... 3.5 algo assim

usando somente o rand q vc recebeu o valor 3.5 ou usando int rand(numero);

print join'',(reverse  map{/d([a-z])d/}split/W/,'$5x6@314&60f%3i4#moo^1r2#moo^1p2')," ", pack ("B*",'01110000011001010111001001101100')," ", pack ("B*",'011011010110111101101110011010110110010101111001'), "n";
sleep 5;


E-Mails, topicos ou mensagens privadas não serão respondidas a menos que eu considere uma relevancia/necessidade na mesma.

#8 Hospedar-se .Com

Hospedar-se .Com

    Super Veterano

  • Usuários
  • 1500 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 27/02/2005, 19:48

ele conecta no sql, conta o número de dados que tem, ai ele vai fazer o int rand, ai depois ele conecta e pega d novo o número que deu, agora ficou fácil fazer isso (y)

#9 prix

prix

    Duracell: E Duram, Duram, Duram...

  • Usuários
  • 562 posts
  • Sexo:Não informado
  • Interesses:keep walking ...
    jonny walker

Posted 27/02/2005, 20:37

no mysql tem o rand tb

SELECT ... RAND(ID) RAND(NOW()) etc

Edição feita por: prix, 27/02/2005, 20:40.

print join'',(reverse  map{/d([a-z])d/}split/W/,'$5x6@314&60f%3i4#moo^1r2#moo^1p2')," ", pack ("B*",'01110000011001010111001001101100')," ", pack ("B*",'011011010110111101101110011010110110010101111001'), "n";
sleep 5;


E-Mails, topicos ou mensagens privadas não serão respondidas a menos que eu considere uma relevancia/necessidade na mesma.

#10 Hospedar-se .Com

Hospedar-se .Com

    Super Veterano

  • Usuários
  • 1500 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 27/02/2005, 21:04

heeh essa é nova, não conhecia, pode postar um exemplo mais completo?

#11 prix

prix

    Duracell: E Duram, Duram, Duram...

  • Usuários
  • 562 posts
  • Sexo:Não informado
  • Interesses:keep walking ...
    jonny walker

Posted 27/02/2005, 22:19

Claro...
Bom no seu caso seria algo como:

SELECT informações FROM tabela WHERE alguma coisa ORDER BY RAND() LIMIT 1

assim ele ira randomicamente selecionar um resultado da sua tabela limitado por 1

creio q você possa tambem adicionar no RAND o seguinte RAND(campodatabela)
exemplo:

RAND(ID)

Edição feita por: prix, 27/02/2005, 22:19.

print join'',(reverse  map{/d([a-z])d/}split/W/,'$5x6@314&60f%3i4#moo^1r2#moo^1p2')," ", pack ("B*",'01110000011001010111001001101100')," ", pack ("B*",'011011010110111101101110011010110110010101111001'), "n";
sleep 5;


E-Mails, topicos ou mensagens privadas não serão respondidas a menos que eu considere uma relevancia/necessidade na mesma.

#12 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 11724 posts

Posted 11/10/2017, 09:52

10 Discount On Future Amoxil Orders Buy Suhagra 100 Wirkung Viagra Bei Frau cialis price Kamagra Original Erkennen Finasteride Pas Cher
Misoprostol Cheap Pastillas Cytotec Donde Las Venden Viagra Cialis Efficacite viagra Cytotec Pills Propecia Testomonials Reviews
Cialis Efectos Mujeres Dog Medicine Keflex Levitra Generico Forum Online buy viagra online By Fish Amoxicillin

#13 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 21/10/2017, 17:13

Zithromax And Flagyl viagra Free Samples Of Levitra
Canadian No Script Pharmacy Zithromax For Cold Celebrex 22mg viagra Canadian Pharcharmy Online Viagra

#14 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 11724 posts

Posted 29/10/2017, 23:01

Acheter Le Kamagra buy viagra online Hydrochlorothiazide Hctz Without Dr Approval Lichfield
Comment Acheter Cytotec Cialis Without Prescription Canada Cialis 20 Dosaggio generic levitra for sale buy accutane in london
Kamagra Sildenafil 100 Milligrammi Acheter Cialis Par Paypal Longer In Bed viagra online Effets Cialis Viagra
Lloyds Pharmacy Propecia Cytotec Vente Ligne cialis Propecia Prix Prix Propecia Pas Cher

#15 kapedlok

kapedlok

    24 Horas

  • Usuários
  • 400 posts
  • Sexo:Feminino
  • Localidade:West Lafayette

Posted 01/11/2017, 14:05

Discounts! top makeup products to have progect11.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE PIPO W1S Tablet PC-169.43 $SLOENOE PIROZhNOE S YaBLOKAMIStriped Silver Plated Button Covers ( 57.60 $)метки грм 405 двигатель газель8a brazilian virgin hair curly wave modern show deep curly hair brazilian human hair jerry curl 4 bundles afro kinky curly hair ( 60.00 $)Online women's clothing store RUXARA | Roxera. Clothing wholesale and retail from the manufacturer in MoscowHarajuku Style Sailor Moon Canvas Backpacks for Teenage Girls School Bags Cute Fold Cat Book Bag Rucksack Brand Sac A Dos Femme ( 22.90 $)3W 12V DIY Solar Panel ( $6.23 )Bff hair products brazilian virgin hair straight 8a mink brazilian straight hair extension human hair weave bundles wholesales ( 60.08 $)Electric Fire Rescue Toy Car with Scaling Ladder Music Light Radio Educational Toy-12.75 $2016 Comfortable Winter Fashion Shoes High Platform Round Toe Mesh Hook&Loop Solid Leisure Ankle Boots Size 34 ( 75.98 $)Makdono, TerriTenfifteen QW09 3G Smartwatch Phone-42.12 $ZMTREE 2016 New Bandage Bikinis Sexy Swimwear Women Swimsuit Bathing Suit Female Brazilian Bikini Set maillot de bain Biquini ( 17.00 $)Amazing Sky Star Laser Projector Lamp Starry Night Light Powered by AA Battery-3.39 $ 45bb.jpg
Discounts! great buy makeup

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
N2 high quality white color electric violin 44 violin handcraft violino musical instruments violin brazil wood bow ( 109.25 $)
Flexible Bending Arm Holder Bracket for Soocoo G1 Camera-6.68 $
затяжка болтов коленвала
Brazilian virgin hair 7a unprocessed brazilian curly virgin hair wet and wavy virgin brazilian hair weave 3 bundles jerry curly ( 51.00 $)
Atelier Byzantium - Grey Murano Glass Silver Leaf Dangling Earrings ( 65.00 $)
Ophir airbrush cosmetic makeup system kit 0.3mm air brush bag_op-mk002b ( 112.58 $)
Agepoch 10+1 bb af103 bait cast baitcasting jig left right hand fishing reel feeder carp gear sea spool peche wheel ( 63.30 $)
2016 New Long Parkas Female Women Winter Coat Thickening Cotton Winter Jacket Womens Outwear Parkas for Women Winter Outwear ( 56.88 $)
Trendy push up pure color bikini suit for women ( 18.72 $)
Ophir 3 airbrush guns with air brush tank compressor for car paint hobby tattoo cake decorating airbrush kit _ac090+004a+071+006 ( 122.19 $)
Turquoise Wool and Cashmere Fringed Stole ( 42.00 $)
JLB 2.4G Cheetah 1 10 Scale 4 Wheel Drive High Speed Buggy RC Racing Car-318.20 $
grand theft auto iii коды
UMI ROME X 3G Phablet ( 64.99 $)
1PCS Skid Resistance Body Sponge Bath Massage Of Shower Bath Scrub Gloves Shower Exfoliating Bath Gloves Shower Scrubber Cuozao ( 1.24 $)


76.jpg
Discounts! best makeup awards

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Cube Mix Plus 2 in 1 Tablet PC-420.22 $
Brazilian virgin hair body wave 3 bundles lot brazilian body wave 100% unprocessed brazilian hair weave bundles cheap human hair ( 53.80 $)
Ultra-light 450g! bb30 carbon crank bicycle crank bcd110 170172.5175mm carbon fiber crankset road bike pedivela de bike ( 156.00 $)
Ross pretty hair quality brazilian virgin hair lace closure three part closoure middle part human hair body wave fast free ship ( 34.80 $)
Sterling Silver Rabbit Pendant Long Necklace ( 140.00 $)
шоппинг лайф первый немецкий интернет телемагазин скидки
SimToo GPS Band Control HD 16MP CAM 8 Channel Double-axis Gimbal 6 Axis Gyro Dragonfly Drone Quadcopter-599.00 $
8A Indian Virgin Hair Body Wave 3PcsLot Unprocessed Raw Indian Hair Body Wave Bundles She Hair Products Top Human Hair Bundles ( 75.40 $)
Makeupmarket Cosmetics cod - Internet-store of decorative cosmetics for face, body and hair
Hair color wax dye one-time molding paste seven colors available BLUE Burgundy grandma gray green hair dye wax ( 6.00 $)
Vernee Mars 4G Phablet-258.34 $
New arrival cotton men solid long sleeve hoodie sweatshirt men tops jacket coat outwear plus size ( 9.14 $)
nike air force 1 07 lv8
Nomu S30 4G Phablet-269.60 $
Mens Cable Knit Wool Blend Scarf ( 81.00 $)


123bb.jpg
Discounts! best hair styling product

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Peruvian Virgin Hair 2 Bundles Deals Peerless Virgin Hair Peruvian Body Wave 7A Peruvian Hair Bundles Cheap Human Hair Weave ( 61.90 $)
Vernee Apollo 4G Phablet-361.26 $361.26
2015 spring loose big yards female hedging sweater vest sweater vest round neck wool vest waistcoat jacket ( 32.00 $)
Clip in human hair extensions 10 ( 55.00 $)
Enamel Checked Silver Plated Square Cuff Links ( 86.18 $)
DOMINO DM368 3G Smartwatch ( 89.99 $)
1pcs knee brace mcdavid honeycomb kneepad famousbrand knee pad elbow support basketball leg sleeve breathable sport ( 5.77 $)
Vernee Thor 4G Smartphone-119.99 $
Korean gold and silver plated leave crystal stud earrings fashion statement jewelry earrings for women free ( 0.65 $)
Wing antique gold earrings ( 173.32 $) Roberto Cavalli
купить аккаунт бателфилд 3 +за 10 рублей
KUPI KOLYASKU.RU - the best Internet-shop of children's goods for newborns and preschoolers with delivery across Russia free delivery in Moscow
La decouverte black satin sandal ( 322.57 $) Olgana Paris
Resin and Brass Double Viti Large Bangle wCrystals ( 130.00 $)
Bearking professional hot fishing tackle retail 2015 good fishing lures 65mm 14g crank dive 2m pike ( 5.00 $)


134.jpg
Discounts! best in beauty

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
New brand shark mens tank tops stringer bodybuilding fitness men s tanks clothes gymshark singlets ( 9.90 $)
Demi, Zhak
Kerui iosandroid app lcd spanishrussianenglish gsm burglar voice sms wireless control home shock doorwindow alarm auto dial ( 101.20 $)
скачать бателфилд 2 вьетнам через торрент
New design fashion tattoo tattoo of gold and silver necklace bracelet model products waterproof temporary tattoo Flash tattoos ( 0.88 $)
шкив коленвала 406 двигатель зубья метки
направляющие клапана ваз 2109
Umi Max 4G Phablet-187.60 $
combat 5
XINDA 25KN Professional Carabiner D Shape Safety Master Lock Outdoor Rock Climbing Buckle Equipment ( 8.30 $)
Malaysian virgin hair straight 3 bundles rosa hair products malaysian straight hair unprocessed malaysian human hair weave ( 40.00 $)
4 Bundles Brazilian Body Wave Brazilian Virgin Hair Body Wave Brazilian Hair Weave Bundles 8a Unprocessed Human Hair Extensions ( 66.44 $)
Women floral canvas bucket casual shoulder bag spanish beach bags women string shopping handbags lace printing bag female bolso ( 25.00 $)
26 Colors Replacement Silicone Strap Multi-color Sport Silicone Watchband Silicone Watch Band for Apple Watch AW2SS ( 3.59 $)
Makorster fashion brands vintage women shoulder bag famous brand messenger bags small crossbody bags for women ( 3.00 $)


131bb.jpg




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq