Return-Path: Received: from atl4mhob17.myregisteredsite.com ([209.17.115.57] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 5284479 for AE-List@media-motion.tv; Wed, 13 Nov 2013 12:21:38 +0100 Received: from mailpod.hostingplatform.com ([10.30.71.205]) by atl4mhob17.myregisteredsite.com (8.14.4/8.14.4) with ESMTP id rADBNP4l024566 for ; Wed, 13 Nov 2013 06:23:25 -0500 Received: (qmail 26624 invoked by uid 0); 13 Nov 2013 11:23:25 -0000 X-TCPREMOTEIP: 60.225.197.206 X-Authenticated-UID: chris@chriszwar.com Received: from unknown (HELO ?192.168.0.3?) (chris@chriszwar.com@60.225.197.206) by 0 with ESMTPA; 13 Nov 2013 11:23:24 -0000 From: Chris Zwar Content-Type: multipart/alternative; boundary="Apple-Mail=_1366F131-4F95-4DD6-B7F3-3A9B4D8E4030" Message-Id: <055CF9AB-B4B9-437B-B3FB-E2EDA3E22CC7@chriszwar.com> Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: [AE] freeze frame from precomp - expression needed to not get duplicates Date: Wed, 13 Nov 2013 22:23:22 +1100 References: To: "After Effects Mail List" In-Reply-To: X-Mailer: Apple Mail (2.1510) --Apple-Mail=_1366F131-4F95-4DD6-B7F3-3A9B4D8E4030 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 This question has come up before, and I remember someone else explaining = that you will need to use a custom random number generator, and not just = the generic random expression. As you have realised, the problem with = random() is that even though the numbers are random there is nothing to = stop the same number being randomly chosen more than once. You need to use a "monte carlo" random number expression, which I don't = have and am not sure where you find one. I think the algorithm is = normally used to shuffle a deck of cards, hence the name. I guess when = you want a computer to create a random deck of cards it's important to = know that each card only appears once! It might be quicker to do it manually. HTH -Chris On 13/11/2013, at 9:18 AM, Greg Balint wrote: > Got a quick one here.. something i'm probably just either not familiar = with, or I'm thinking too hard about it. >=20 > I've got a large grid wall of squares with people's faces in them. = Each face panel is the same precomp with this expression in the = time-remap attribute. >=20 > seedRandom(index,true); > myFrame =3D Math.floor(random(303)); > framesToTime(myFrame) >=20 > Basically this grabs a random frame from the precomp, which is about = 10 seconds long, and shows it as a freeze frame for that particular = layer. >=20 > I've got 125 face panels all using this expression, and for the most = part it works wonderfully.. they all have random faces on them, and if I = add another layer, the random seed changes and I get a whole new slew of = faces (which doesn't matter in this instance, but i could see that as a = problem in others) >=20 > My issue is, even though I've got over 300 frames (each frame with a = new face) in my precomp.. the randomness is grabbing duplicates.. in = some cases 2-3 pairs of duplicates over the course of the 125 it = chooses. >=20 >=20 > Anyone know of a way to append this script so that it does not choose = something it has already? >=20 > I'd even be fine if there were a way to use an expression to grab = frames sequentially from the precomp and then I could just hand choose = to make sure there's no duplicates in the first 125 frames. >=20 > I think i might just be overthinking this, but I'm not sure if I've = seen a "check for duplicate and don't use" sort of expression before. >=20 > thanks in advance. >=20 > --=20 > ///Greg Balint > //Art Director / Motion Graphics Designer > /321.514.4839 > delRAZOR.com/=20 --Apple-Mail=_1366F131-4F95-4DD6-B7F3-3A9B4D8E4030 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 This = question has come up before, and I remember someone else explaining that = you will need to use a custom random number generator, and not just the = generic random expression.  As you have realised, the problem with = random() is that even though the numbers are random there is nothing to = stop the same number being randomly chosen more than = once.

You need to use a "monte carlo" random number = expression, which I don't have and am not sure where you find one. =  I think the algorithm is normally used to shuffle a deck of cards, = hence the name.  I guess when you want a computer to create a = random deck of cards it's important to know that each card only appears = once!

It might be quicker to do it = manually.

HTH
-Chris

= On 13/11/2013, at 9:18 AM, Greg Balint <delrazoraelist@gmail.com> = wrote:

Got a quick one here.. something i'm = probably just either not familiar with, or I'm thinking too hard about = it.

I've got a large grid wall of squares with = people's faces in them.  Each face panel is the same precomp with = this expression in the time-remap attribute.

seedRandom(index,true);
myFrame =3D = Math.floor(random(303));
framesToTime(myFrame)

Basically this grabs a random frame from the precomp, which is = about 10 seconds long, and shows it as a freeze frame for that = particular layer.

I've got 125 face panels all using this expression, = and for the most part it works wonderfully.. they all have random faces = on them, and if I add another layer, the random seed changes and I get a = whole new slew of faces (which doesn't matter in this instance, but i = could see that as a problem in others)

My issue is, even though I've got over 300 frames = (each frame with a new face) in my precomp.. the randomness is grabbing = duplicates.. in some cases 2-3 pairs of duplicates over the course of = the 125 it chooses.


Anyone know of a way to append this = script so that it does not choose something it has = already?

I'd even be fine if there were a way = to use an expression to grab frames sequentially from the precomp and = then I could just hand choose to make sure there's no duplicates in the = first 125 frames.

I think i might just be overthinking this, but I'm = not sure if I've seen a "check for duplicate and don't use" sort of = expression before.

thanks in advance.

--
///Greg Balint
//Art Director / Motion Graphics Designer
/321.514.4839
delRAZOR.com/ 

= --Apple-Mail=_1366F131-4F95-4DD6-B7F3-3A9B4D8E4030--