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).
- Deep Toaster
- Expert (Posts: 748)
- 20 Oct 2011 06:08:54 pm
- Last edited by Deep Toaster on 20 Oct 2011 09:46:40 pm; edited 1 time in total
ok. So the rand(5 would it randomize only the first 5 digits or randomize them by all by a factor of 5?
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.
Try this code to randomly fill an 8x8 square using TI BASIC:
Code:
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
- Meishe91
- Newbie (Posts: 25)
- 21 Oct 2011 01:29:42 am
- Last edited by Meishe91 on 21 Oct 2011 10:51:31 am; edited 1 time in total
souvik1997 wrote:
Try this code to randomly fill an 8x8 square using TI BASIC:
Code:
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:
Use Y be
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:
Use Y be
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
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
» Go to Registration page
» Goto page Previous 1, 2
» View previous topic :: View next topic
» View previous topic :: View next topic
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
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