WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-05-2010, 11:10 PM
CRI CRI is offline
Member
 
Join Date: Mar 2010
Posts: 26
Random array

Is there any way I can create an array of

Continuous random sort it

thank all !!
Reply With Quote
  #2  
Old 09-07-2010, 02:29 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can use one of the functions from Python's random module to generate random numbers and place those in a list. Lists have a sort method you can use to sort the elements within.
Code:
import random
numbers = []
for i in range(1,10):
	number = random.randint(1,10)
	numbers.append(number)
	
print numbers
numbers.sort()
print numbers
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
random coding Saz Vizard 1 05-27-2010 05:44 PM
random speed and associated coding Saz Vizard 1 05-20-2010 04:03 AM
Semi-circle array containing target and distractor objects ptjt255 Vizard 3 08-04-2009 03:09 AM
Random head movements VR_enthusiast Vizard 2 07-19-2006 11:59 AM
Copy objects in an array to another array Johannes Vizard 3 04-29-2005 02:37 PM


All times are GMT -7. The time now is 06:59 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC