Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Turing

Name: Anonymous 2012-01-08 21:14

Need to sort 10 randomly generated numbers with arrays and bubble sorting. I've figured out how to get the sorting, but how do I randomize the numbers?

Name: Anonymous 2012-01-08 21:21

TAoCP Vol. 2.

Name: Anonymous 2012-01-08 21:29

Throw the keyboard from the 10th floor. Do it 10 times.

Name: Anonymous 2012-01-08 21:55


let A be an array with indeces ranging from 1 to n
  for i from 1 to n
    let j be a random index with i < j <= n
      swap(A[i], A[j])

Name: Anonymous 2012-01-08 22:46

from random import randrange
array = []
for i in range(0,9):
    array.append(randrange(5000))
array.sort()
print array

Name: Anonymous 2012-01-09 1:43

>>5
array = [randrange(5000) for i in xrange(9)]

Name: Anonymous 2012-01-09 2:04

>>6
PIG DISGUSTING!

Name: Anonymous 2012-01-09 3:59

>>7
umad lithp fag?

Name: Anonymous 2012-01-09 4:11

>>8
Not even.
(loop repeat 10 collect (random 5000))

Name: Anonymous 2012-01-09 4:33

>>9
why not just (repeat 10 collect (random 5000))?

Name: Anonymous 2012-01-09 4:50

>>10
wat

Name: Anonymous 2012-01-09 6:45

Make 10 posts on /b/. Record the last digit of your post numbers.

Name: Anonymous 2012-01-09 8:20


int[] listInts = new int[10];
Random r = new Random();
for (int i = 0; i < 10; i++)
  listInts[i] = r.Next(5000);

Name: Anonymous 2012-01-09 11:03

A[⍋A←10?5000]

Name: Anonymous 2012-01-09 13:46

for n in {0..9}; do printf "$RANDOM\n" done | sort -n

Don't change these.
Name: Email:
Entire Thread Thread List