so there is no way to add the points to a list as They are being made then check to see if It is already in a list before plotting the point?
It's possible, but it would be a lot slower than generating all of the points ahead of time and going through them in a random order (such as by shuffling the list).
ok. So I would just have to make the entire list. then How would I suffle it?
TI-BASIC wrote:
:{1,2,3,4,5→L1
:rand(5→L2
:SortA(L2,L1
See my post here Smile
ok. So the rand(5 would it randomize only the first 5 digits or randomize them by all by a factor of 5?
rand(5 creates a list of five random numbers from 0 to 1. Try it.
oh. So. it would create decimals basically..... So how would decimals help with pixels. Dont they have to be integers?
No, it wouldn't. L1 is what you're working with. You should put all the points in there before doing that sorting stuff. L2 is used only for shuffling L1.
Ok. I will try that then. Thanks.
Try this code to randomly fill an 8x8 square using TI BASIC:

Code:
.1seq(A,A,0,7->L1
For(X,1,7
augment(L1,X+.1seq(A,A,0,7->L1
End
rand(64->L2
SortA(L2,L1
ClrDraw
For(X,1,64
Pxl-On(int(L1(X)),10fPart(L1(X
End
souvik1997 wrote:
Try this code to randomly fill an 8x8 square using TI BASIC:

Code:
.1seq(A,A,0,7->L1
For(X,1,7
augment(L1,X+.1seq(A,A,0,7->L1
End
rand(64->L2
SortA(L2,L1
ClrDraw
For(X,1,64
Pxl-On(int(L1(X)),10fPart(L1(X
End


Optimized:

Code:
64→dim(L1
For(Z,0,7
For(X,0,7
X+.1Z→L1(8Z+8-X
End
End
rand(64→L2
SortA(L2,L1
ClrDraw
For(X,1,64
L1(X
Pxl-On(int(Ans),10fPart(Ans
End


More if you call with [tt]ClrDraw:64→dim(L1:prgmA[/tt]:

Code:
For(Z,0,7
For(X,0,7
X+.1Z→L1(8Z+8-X
End
End
rand(64→L2
SortA(L2,L1
For(X,1,64
L1(X
Pxl-On(int(Ans),10fPart(Ans
End
But you optimized L2 out, and the user has to initialize L1 himself D:

Here's mine:


Code:
:cumSum(not(binompdf(7,0→L1
:For(X,0,6)
:augment(Ans,L1+.1X
:End
:Ans→L1
:rand(64→L2
:SortA(L2,L1
:For(X,1,64
:L1(X
:Pxl-On(iPart(Ans),10fPart(Ans
:End


Use Y be
Aes_Sedia5 wrote:
oh. So. it would create decimals basically..... So how would decimals help with pixels. Dont they have to be integers?
I hope that you can explain back to us how those three lines work in your own words now.
Deep Thought wrote:
But you optimized L2 out, and the user has to initialize L1 himself D:

Here's mine:


Code:
:cumSum(not(binompdf(7,0→L1
:For(X,0,6)
:augment(Ans,L1+.1X
:End
:Ans→L1
:rand(64→L2
:SortA(L2,L1
:For(X,1,64
:L1(X
:Pxl-On(iPart(Ans),10fPart(Ans
:End


Use Y be


Oops, my bad. I forgot to put the →L2. Put them back in.

Edit:
Crap, no teletype BBCode tags Razz
Nope, not on phpBB forums.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement