Skip to content

Commit

Permalink
Update random.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhermeNobrega authored May 2, 2024
1 parent b782f45 commit 68fad99
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions random.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ echo "$random"
#O tamanho do intervalo é $p1 - $p2 + 1 = 10 - 5 + 1 = 6.
#O cálculo $RANDOM % 6 gera um número aleatório entre 0 e 5 (inclusive).
#Então, random = 5 + (número aleatório entre 0 e 5), que dá um número aleatório entre 5 e 10 (inclusive).

#=================================================== MORE SIMPLE =================================================

#!/bin/bash

read -p "Type the max value, to select a random value: " max
random=$(( $RANDOM % $max +1 ))
echo "Your random value is: $random"

0 comments on commit 68fad99

Please sign in to comment.