This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

"uniformly" randomizing arrays

Help for those learning Tcl or writing their own scripts.
Post Reply
s
stevenjm
Voice
Posts: 2
Joined: Tue May 16, 2006 8:52 am
Location: Johannesburg, South Africa

"uniformly" randomizing arrays

Post by stevenjm »

Hi all

I have the following set ...

Code: Select all

set acrosbynum([expr [array size acrosbynum]+1]) $text
set acrosbyname([strlwr $nick]) $text
set acrorealnames([strlwr $nick]) $nick
set acronumsbyname([strlwr $nick]) [array size acrosbynum]
set acronamesbynum([array size acrosbynum]) [strlwr $nick]
Now ... the problem is when this displays to the channel later on ... each user that submitted first - will always be displayed first ... i wish to change this.

Code: Select all

while {$_i<=[array size acrosbynum]} {
	putmsg $acrochan "$_i. [strlwr $acrosbynum($_i)]"
	set acrovotes($_i) 0
	incr _i
}
I am able to change randomise the acrosbynum etc induviualy, but it will put everything out of sync.

Does anyone have a suggestion for this ... i know its way beyond my current scope of knowledge :(
Post Reply