π
<-
Chat plein-écran
[^]

la fonction rand()

Pour le TI-Basic sur Nspire

la fonction rand()

Unread postby kadtexas » 31 May 2018, 17:58

Bonjour

La fonction randint(n,m) renvoit un entier r, n<= r <=m
La fonction rand() renvoit un réel entre 0 et 1 (avec beaucoup de décimales)
Je ne vois pas à quoi elle sert !

Merci pour des réponses
User avatar
kadtexas
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 73.8%
 
Posts: 283
Joined: 29 Jan 2015, 19:32
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: etudiant

Re: la fonction rand()

Unread postby Ti64CLi++ » 31 May 2018, 18:07

La fonction rand() renvoie un nombre (pseudo-)aléatoire, compris entre 0 et 1.
Cela peut servir pour certain calcul ;)
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.3%
 
Posts: 3441
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

Re: la fonction rand()

Unread postby kadtexas » 01 Jun 2018, 11:14

Bonjour
Cela peut servir pour certain calcul


Par exemple ?
User avatar
kadtexas
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 73.8%
 
Posts: 283
Joined: 29 Jan 2015, 19:32
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: etudiant

Re: la fonction rand()

Unread postby Hamza.S » 01 Jun 2018, 11:38

Il n'y a qu'en probabilité qu'on a besoin de nombres aléatoires
Image
User avatar
Hamza.SAdmin
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 28.5%
 
Posts: 4461
Images: 18
Joined: 07 Nov 2014, 00:43
Gender: Male
Calculator(s):
MyCalcs profile

Re: la fonction rand()

Unread postby kadtexas » 01 Jun 2018, 13:03

Il n'y a qu'en probabilité qu'on a besoin de nombres aléatoires


Justement, pile-face ={0;1} par exemple, dé ={1,2,3,4,5,6} etc... mais générer un réel entre 0 et 1 :0,230459... je ne vois pas à quoi ça sert ?
Mais ce n'est pas grave, c'était juste par curiosité !
User avatar
kadtexas
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 73.8%
 
Posts: 283
Joined: 29 Jan 2015, 19:32
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: etudiant

Re: la fonction rand()

Unread postby UnCurieux » 01 Jun 2018, 16:25

Cela peut servir par exemple pour calculer une approximation de pi selon la méthode de Monte-Carlo :
lis ceci : https://fr.wikipedia.org/wiki/M%C3%A9th ... _de_%CF%80
Une archive l'utilisant (lignes 46,47,98,99) : archives_voir.php?id=1495596
Maths, fractales, géométrie, packs de levels Oiram, jeux, physique, ... : ici

ImageImage
User avatar
UnCurieuxProgrammeur
Niveau 11: LV (Légende Vivante)
Niveau 11: LV (Légende Vivante)
Level up: 23.7%
 
Posts: 367
Images: 2
Joined: 19 May 2017, 18:20
Gender: Male
Calculator(s):
MyCalcs profile
Class: Prépa scientifique 1A

Re: la fonction rand()

Unread postby kadtexas » 01 Jun 2018, 18:01

Merci pour la réponse
User avatar
kadtexas
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 73.8%
 
Posts: 283
Joined: 29 Jan 2015, 19:32
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: etudiant


Return to Nspire-Basic

Who is online

Users browsing this forum: No registered users and 18 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
2599 utilisateurs:
>2589 invités
>5 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)