Aide:Random.txt
De Wiki AutoIt Français
Document original V3.3.6.1 :
###Function###
Random
###Description###
Generates a pseudo-random float-type number.
###Syntax###
Random ( [Min [, Max [, Flag]]] )
###Parameters###
@@ParamTable@@
Min
[optional] The smallest number to be generated. The default is 0.
Max
[optional] The largest number to be generated. The default is 1.
Flag
[optional] If this is set to 1 then an integer result will be returned. Default is a floating point number.
@@End@@
###ReturnValue###
@@ReturnTable@@
Success: Returns a pseudo-random number between Min and Max.
Failure: Returns 0 and sets @error flag to 1 if bad parameters.
@@End@@
###Remarks###
By default the Random function works with decimal/floating point numbers. If you want to only have integer/whole number results then set the Flag to 1.
If only one argument is provided, then it is interpreted to be the Max.
The result will be in the range of Min to Max INCLUSIVE when using integers (just short of Max when using floats).
When using integers Max-Min must be less than 2^31.
<br><b>Comments based on the original source</b>
This function uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura, Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.
The Mersenne Twister is an algorithm for generating random numbers. It was designed with consideration of the flaws in various other generators. The period, 2<sup>19937</sup>-1, and the order of equidistribution, 623 dimensions, are far greater. The generator is also fast; it avoids multiplication and division, and it benefits from caches and pipelines. For more information see the inventors' web page at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
###Related###
Round, SRandom
###Example###
@@IncludeExample@@
Document traduit V3.3.6.1 :
###Function###
Random
###Description###
Génère un nombre pseudo-aléatoire à virgule flottante.
###Syntax###
Random ( [Min [, Max [, Flag]]] )
###Parameters###
@@ParamTable@@
Min
[optionnel] Le plus petit nombre qui peut être généré. La valeur par défaut est 0.
Max
[optionnel] Le plus grand nombre qui peut être généré. La valeur par défaut est 1.
Flag
[optionnel] S'il est mis à 1, un résultat entier sera retourné. Par défaut c'est un nombre à virgule flottante.
@@End@@
###ReturnValue###
@@ReturnTable@@
Succès: Retourne un nombre pseudo-aléatoire entre Min et Max.
Échec: Retourne 0 et met @error à 1 si les paramètres sont mauvais.
@@End@@
###Remarks###
Par défaut la fonction Random travaille avec des nombres décimaux à virgule flottante. Si vous ne voulez que la partie entière des résultats, mettez cette option à 1.
Si un seul argument est fourni, alors il est interprété comme étant la valeur maximum.
Le résultat sera dans l'intervalle du nombre Minimum au nombre Maximum INCLUS lors de l'utilisation des entiers (un peu moins du Maximum lorsqu'il s'agit de nombres à virgules).
Lors de l'utilisation des entiers, les nombres Maximums et Minimums doivent être inférieurs à 2^31.
<br><b>Commentaires basés sur la source originale</b>
Cette fonction utilise le générateur de nombre aléatoire Mersenne Twister, MT19937, écrit par Takuji Nishimura, Makoto Matsumoto, Shawn Cokus, Matthe Bellew et Isaku Wada.
Le Mersenne Twister est un algorithme de génération de nombres aléatoires. Il a été conçu en tenant compte des failles dans divers autres générateurs. La limite, 2<sup>19937</sup>-1 et l'ordre de l'équidistribution, 623 dimensions, sont beaucoup plus grands. Le générateur est également rapide, il évite la multiplication et la division, et bénéficie de mémoire cache et de plusieurs canaux de traitement. Pour plus d'informations, voir la page web des inventeurs à http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
Copyright © 1997 - 2002, Makoto Matsumoto et Takuji Nishimura, Tous droits réservés.
La redistribution et l'utilisation des codes source et binaire, avec ou sans modification, sont autorisées à condition que les conditions suivantes soient remplies :
1. Les redistributions du code source doivent conserver la notice de copyright ci-dessus, cette liste de conditions et la décharge suivante.
2. Les redistributions sous forme binaire doivent reproduire la notice de copyright ci-dessus, cette liste de conditions et la décharge suivante dans la documentation et/ou d'autres documents fournis avec la distribution.
3. Les noms de ses contributeurs ne peuvent être utilisés pour avaliser ou promouvoir des produits dérivés de ce logiciel sans autorisation écrite spécifique préalable.
CE LOGICIEL EST FOURNI PAR LES DÉTENTEURS DE DROITS D'AUTEURS ET LES CONTRIBUTEURS "TEL QUEL" ET TOUTE GARANTIE EXPLICITE OU IMPLICITE, Y COMPRIS MAIS SANS LIMITATION DE GARANTIE IMPLICITE DE VALEUR MARCHANDE ET D'ADAPTATION À UN USAGE PARTICULIER SONT RÉFUTÉS. EN AUCUN CAS LE PROPRIÉTAIRE DES DROITS D'AUTEUR OU LES CONTRIBUTEURS NE SAURAIENT ÊTRE TENUS RESPONSABLES DE TOUT DOMMAGE DIRECT, INDIRECT, ACCESSOIRE, SPÉCIAL, DOMMAGES ET INTÉRÊTS OU DOMMAGES CONSÉCUTIFS (Y COMPRIS MAIS SANS LIMITATION FOURNITURE DE MARCHANDISES OU SERVICES DE SUBSTITUTION ; PERTE DE JOUISSANCE, DE DONNÉES OU DE BÉNÉFICES ; NI INTERRUPTION D'ACTIVITÉ) QUELLES QUE SOIENT LEURS CAUSES ET QUEL QUE SOIT LE MOTIF JURIDIQUE INVOQUÉ, CONTRACTUEL, RESPONSABILITÉ CIVILE OU PÉNALE (Y COMPRIS NÉGLIGENCE OU AUTRE), SURVENANT DE QUELQUE MANIÈRE QUE CE SOIT SUITE À L'UTILISATION DU LOGICIEL, MÊME S'ILS ONT ÉTÉ AVISÉS DE LA POSSIBILITÉ DE TELS DOMMAGES.
###Related###
<a href="Round.htm">Round</a>, <a href="SRandom.htm">SRandom</a>
###Example###
@@IncludeExample@@
Traducteur : TT22