Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random Generator
Message
De
23/01/2001 14:46:11
 
 
À
22/01/2001 22:34:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00467103
Message ID:
00467506
Vues:
12
>A fun one. I want to code for a random number from 0 to 35. The challenge is to get that code in less than 6 lines (seven for a tie) as a friend of mine has demonstrated in our other language LINC. Any help will win me a beer!

Ok, here are the smart ass one liners

VFP7
?EXECSCRIPT("=rand(-1)" + CHR(13) + CHR(10) + "lcString = ''" + CHR(13) + CHR(10) + "for lnI = 1 to 20" + CHR(13) + CHR(10) + "lnNumber = int(rand() * 36)" + CHR(13) + CHR(10) + "lcString = lcString + iif(lnNumber < 10, tran(lnNumber), chr(lnNumber + 55))" + CHR(13) + CHR(10) + "endfor" + CHR(13) + CHR(10) + "return lcString")
VFP6

?sys(2015)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform