Erik343
Erik343

Reputation: 335

Random sort not working with --random_source=FILE

I am experimenting with the sort command for Linux. I have file1:

one
two
three
four
five

I tried:

sort -R file

The output of that command is always sorted randomly as expected

I then tried:

sort --random-source=/dev/urandom file1

and the command always has this output:

five
four
one
three
two

Why is the last sort command output always the same? Shouldn't it always be sorted randomly with this command?

Can I get an explanation on why this is occurring?

Upvotes: 1

Views: 105

Answers (1)

set0gut1
set0gut1

Reputation: 1682

--random-source option has no effect without -R option. The result

five
four
one
three
two

is sorted alphabetical correctly. Therefore the result is always same.

Upvotes: 3

Related Questions