begin process at 2010 03 19 06:54:25
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Maths & Algorithmes

 > SUITE DE NOMBRES ALESATOIRES DIFFERENTS

SUITE DE NOMBRES ALESATOIRES DIFFERENTS


 Information sur la source

Note :
7 / 10 - par 1 personne
7,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Maths & Algorithmes Source .NET ( DotNet ) Niveau :Initié Date de création :11/04/2003 Date de mise à jour :11/04/2003 10:49:19 Vu :9 179

Auteur : ErB

Ecrire un message privé
Site perso
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 Description

POUR .... trouver  une suite de nombres alesatoires et TOUS differents

Source

  • Public Function nombresDifferents(ByVal Combien As Int32, ByVal mini As Int32, ByVal maxi As Int32) As ArrayList
  • Dim mAR As New ArrayList()
  • Dim i As Int32
  • Dim r As New Random()
  • Dim ar As New ArrayList()
  • Dim nb As Int32
  • Dim compte As Int32
  • For i = mini To maxi
  • ar.Add(i)
  • Next
  • If ar.Count - 1 <= Combien Then
  • Combien = ar.Count
  • End If
  • For i = 1 To Combien
  • nb = 0
  • compte = ar.Count
  • nb = r.Next(compte)
  • mAR.Add(ar(nb))
  • ar.RemoveAt(nb)
  • Next
  • Return mAR
  • End Function
Public Function nombresDifferents(ByVal Combien As Int32, ByVal mini As Int32, ByVal maxi As Int32) As ArrayList

Dim mAR As New ArrayList()

Dim i As Int32
Dim r As New Random()

Dim ar As New ArrayList()
Dim nb As Int32
Dim compte As Int32


For i = mini To maxi
ar.Add(i)
Next

If ar.Count - 1 <= Combien Then
Combien = ar.Count
End If

For i = 1 To Combien
nb = 0

compte = ar.Count
nb = r.Next(compte)

mAR.Add(ar(nb))
ar.RemoveAt(nb)
Next

Return mAR

End Function 

 Conclusion

Public Function nombresDifferents(ByVal Combien As Int32, ByVal mini As Int32, ByVal maxi As Int32) As ArrayList

combien = combien de nombres aleatoires vous voulez tirer

mini maxi = fourchette (de 21 a 128 par exemple)


 Sources du même auteur

Source .NET (Dotnet) LISTER LES COULEURS WEB GRACE A LA REFLEXION
Source .NET (Dotnet) ECHANGE DE VALEURS ENTRE 3 PAGES (TRANSFER / EXECUTE)
Source .NET (Dotnet) LISTER LES FICHIERS D'UN DOSSIER
Source .NET (Dotnet) IP / HOSTNAME
Source .NET (Dotnet) AJOUTER DES OPTIONS A ADROTATOR

 Sources de la même categorie

Source avec Zip CARRÉ MAGIQUE par stankov
Source avec Zip Source avec une capture ZIPVIEWER - LISTER LE CONTENU D'UN ZIP par ghuysmans99
AFFICHER LES LIGNES D'UN DATATABLE DS UN ORDRE ALÉATOIRE par taillecrayon
CONVERTIR UN NOMBRE DE BASE 10 EN BASE 36 ET L'INVERSE par Aurelyyy
Source avec Zip CRYPTAGE ALPHA NUMÉRIQUE par MalcolMZ

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,390 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales