Notifications
Clear all

[Closed] Using ArrayCount in parrameters?

Hi all,

Just wondering is it possible to use an array count to a random function.

E.G

MyArray =#(A,B,C,D)

Random 1 MyArray.cont

Basically I want to random between 1 and 4 but using the count to feed the random its parramater. Is this possible?

Thanks

13 Replies

you just misspelt “count”.

MyArray =#(A,B,C,D)
 
 val = Random 1 MyArray.count

Yup. Here is the one of many ways


 MyArray =#("A","B","C","D")
 fn randomizeArray arr seeding: =
 (
 	newarr = #()
 seed seeding
 	while newarr.count != arr.count do appendIfunique newarr arr[random 1 arr.count]
 	newarr
 )
 randomizeArray MyArray seeding:0

or this one

MyArray =#("A","B","C","D")
fn randomizeArray arr seeding: =
(
	newarr = #()
seed seeding
	while newarr.count != arr.count do 
		if finditem newarr (item = arr[random 1 arr.count]) == 0 do append newarr item
	newarr
)
randomizeArray MyArray seeding:0
2 Replies
(@denist)
Joined: 11 months ago

Posts: 0

try to apply these methods to long arrays (100,000+). they both are endless. because they are wrong

(@gazybara)
Joined: 11 months ago

Posts: 0

Here we go again:) My head still hurts from “group” thread.
Can we start discussion (6 pages min)?

Also looking this tool there are more randomization methods.
Who knows how to create Solid, Chaos I and Chaos II functions.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i remember this tool… it was very slow which means it was using bad randomization functions too

Whoops, sorry about the typo!

Wow thanks, that is a big help, also interesting to see the other ways to randomise, very helpful!

Thank you very much!

Shan

we don’t have to… there is the answer in mini-challenge #1 thread on this forum

3 Replies
(@gazybara)
Joined: 11 months ago

Posts: 0

I can’t find mini-challenge #1. Search Forum find only #2 and above challenges.

(@denist)
Joined: 11 months ago

Posts: 0
(@gazybara)
Joined: 11 months ago

Posts: 0

Thanks. I like this kind of stuff.

Lol its ok, My array will only go up to 25 if that!

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i couldn’t live with it…