Re: [julia-users] random number generation

2016-06-01 Thread cdm

this method does not exclude the possibility that the same integer turns up 
more than once among the six ...

julia> 
rand(1:14, 6)   
  
6-element Array{Int64,1}:
 9
 2
 7
 6
 6
 3
 

On Wednesday, June 1, 2016 at 11:32:34 AM UTC-7, El suisse wrote:
>
> I think like this:
>
> `rand(1:14, 6)`
>
> 2016-06-01 15:24 GMT-03:00 Michela Di Lullo  >:
>
>> How can I do to generate 6 *different* integer random numbers between 1 
>> and 14?
>>
>> Thanks in advance to who will answer, 
>>
>> M.
>>
>> ___
>> INVESTI SUL FUTURO, FAI CRESCERE L’UNIVERSITÀ:
>>
>> *DONA IL 5 PER MILLE ALLA SAPIENZA*
>>
>> CODICE FISCALE *80209930587*
>>
>
>

Re: [julia-users] random number generation

2016-06-01 Thread cdm

a solution, among many:

sub(randperm(14), 1:6)


enjoy !!!


Re: [julia-users] random number generation

2016-06-01 Thread Michele Zaffalon
shuffle(collect(1:14))[1:6] but I remember seeing a method that picks n
random elements from an array.

By the way, shuffle(1:14) does not seem to work.

On Wed, Jun 1, 2016 at 8:32 PM, El suisse  wrote:

> I think like this:
>
> `rand(1:14, 6)`
>
> 2016-06-01 15:24 GMT-03:00 Michela Di Lullo :
>
>> How can I do to generate 6 *different* integer random numbers between 1
>> and 14?
>>
>> Thanks in advance to who will answer,
>>
>> M.
>>
>> ___
>> INVESTI SUL FUTURO, FAI CRESCERE L’UNIVERSITÀ:
>>
>> *DONA IL 5 PER MILLE ALLA SAPIENZA*
>>
>> CODICE FISCALE *80209930587*
>>
>
>


Re: [julia-users] random number generation

2016-06-01 Thread El suisse
I think like this:

`rand(1:14, 6)`

2016-06-01 15:24 GMT-03:00 Michela Di Lullo :

> How can I do to generate 6 *different* integer random numbers between 1
> and 14?
>
> Thanks in advance to who will answer,
>
> M.
>
> ___
> INVESTI SUL FUTURO, FAI CRESCERE L’UNIVERSITÀ:
>
> *DONA IL 5 PER MILLE ALLA SAPIENZA*
>
> CODICE FISCALE *80209930587*
>


[julia-users] random number generation

2016-06-01 Thread Michela Di Lullo
How can I do to generate 6 *different* integer random numbers between 1 and 
14?

Thanks in advance to who will answer, 

M.

-- 
___
INVESTI SUL FUTURO, FAI CRESCERE L’UNIVERSITÀ:

*DONA IL 5 PER MILLE ALLA SAPIENZA*

CODICE FISCALE *80209930587*