> teletype : code exchange

llllllll

#283

Thanks guys !
Given that you two come with the same solution must be a proof of truth !


#284

sooo

I’m trying to parse out why that would work and the mental wall starts @ this command [quote=", post:282, topic:839"]
P I TOSS
[/quote]

what’s the difference between TOSS and FLIP? why does toss accomplish @chapelierfou’s idea?

is this restricted to two pattern banks or does it hop between all four?


#285

FLIP inverts everytime (if 1, then 0… if 0, then 1). TOSS acts like a coin toss and returns 0 or 1 randomly.


#286

Toss is launching a coin in the air.
Flip is flipping the coin on the table.


#287

nicely put

thanks guys


#288

I’d like to populate a pattern with random 1s or 0s, but i also want to specify how many 1s.
Is there a way to do this ?


#289

[quote=“chapelierfou, post:288, topic:839”]
specify how many 1s
[/quote]in what sense?

Sounds like you want some sort of conditional statement to check that there are pauses rather than:

1
1
1
1
1
1
1
1
1
1
1


#290

in script 1, set X to how many 0/1’s you want to generate.


#291

Thank you. Unfortunately, tehn, that’s not my goal.

Let’s say i want to generate 8 steps, with always 3 zeros (and thus 5 ones) :

1 0 0 1 0 0 0 1 or 1 1 1 0 0 0 0 0 or 0 1 0 0 1 0 1 0 etc…

The purpose :
i generate 2 random patterns to trigger the 2 inputs of René. I want it random but i want always the same length for the pattern created by René.


#292

Maybe…but then, i still have no idea how to count the pauses, and how to store the ‘pause sequence’. That would mean the use of a pattern for this. So i’m not sure.


#293

I’m a TT noob and this is untested… and it looks overcomplicating… but maybe something like this?

#1
P.N I
P.L 8
L 0 8 : SCRIPT 2

#2
Z TOSS
X 0
IF GT Y 0 : X Z
Y SUB Y Z
P I X

#I
Y 5
L 0 3 : SCRIPT 1


#294

Thanks very much.
I admit i absolutely don’t get your code. But i’ll try on the TT !


#295

ah, i see what you’re after.

a simple method you might try:

  • fill the pattern with 0’s
  • randomly fill positions with 1’s

you may get repeat randoms of course

set X to number of possible 1’s. 8 is length

L 0 8 : P I 0
L 0 X : P RAND 8 1

#296

That doesn’t guarantee X 1s if the rand in the second loop turns up the same number twice.


#297

yeah, i mentioned that.


#298

You need to shuffle if you want to guarantee that you always have the same number of 1s and 0s.

E.g.

L 0 99 : P.INS 0 P.RM RAND 8

(you need a newish version of the firmware where P.RM returns the value removed).


#299

Makes me think : what about a new operator ‘URN’ like urn in max, to output non equal random numbers ?


#300

i guess i don’t have the good version :
‘Move left : P.RM’ is the message TT returns.


#301

another method, use P.INS randomly

x = how many 0’s
y = how many 1’s

X 3
Y 5
P.L 0
L 0 X : P.INS 0 0
L 0 Y : P.INS RAND P.L 1

untested but the idea should work


#302

Yeah !
Many thanks this works. For the sake of rightness, the correct script is :

X 3
Y 5
P.L 0
L 1 X : P.INS 0 0
L 1 Y : P.INS RAND P.L 1