Visualizzazione dei risultati da 1 a 7 su 7

Discussione: numeri casuali interi

  1. #1
    Utente di HTML.it L'avatar di jet
    Registrato dal
    Dec 2002
    residenza
    Chieti
    Messaggi
    866

    numeri casuali interi

    ho bisogno di generare numeri casuali interi compresi in un intervallo da 1 a 90.


  2. #2
    Utente di HTML.it L'avatar di jet
    Registrato dal
    Dec 2002
    residenza
    Chieti
    Messaggi
    866
    così stampo 6 numeri da 0 a 1.

    <%
    Randomize
    Dim i
    for i=0 to 5
    Response.Write(FormatNumber(Rnd(),2)&"
    ")
    next
    %>

  3. #3
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    Randomize
    numero = Int(Rnd*90) + 1
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  4. #4
    Utente di HTML.it L'avatar di jet
    Registrato dal
    Dec 2002
    residenza
    Chieti
    Messaggi
    866
    così stampo 5 numeri uguali

    <%
    Randomize
    numero = Int(Rnd*90) + 1
    Dim i
    for i=0 to 5
    Response.Write(FormatNumber(numero,2)&"
    ")
    next
    %>

  5. #5
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    <%
    for i=0 to 5
    Randomize
    numero = Int(Rnd*90) + 1
    Response.Write(FormatNumber(numero,2)&"
    ")
    next
    %>
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  6. #6
    Utente bannato
    Registrato dal
    May 2001
    Messaggi
    95
    Questo ti stampa 5 numeri interi tra 0 e 90:


    <%
    for i=1 to 5
    Randomize
    numero = Int(Rnd*90) + 1
    Response.Write(FormatNumber(numero,0)&"
    ")
    next
    %>

  7. #7
    Utente bannato
    Registrato dal
    May 2001
    Messaggi
    95
    Nell'esempio che ti ho dato può capitare che delle volte ti duplichi 2 numeri, ma è un caso raro

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.