[tw] Re: A button to open a random tiddler

2018-02-20 Thread passingby
Guys! Stephan, Mathew Thank you for your efforts. I am always impressed 
with all that mathematics! Although I did take up math in my high school, i 
barely passed in it. I remember sine cos theta angles but nothing more than 
names. But there is always a lurking desire to spend some time on improving 
my math skills and knowledge. I secretly think this is going to make me 
smarter. :-)

But thanks again, I shall try out the changes.

On Tuesday, February 20, 2018 at 6:49:17 AM UTC-7, Matthew Lauber wrote:
>
> I've reworked the shuffle operator to use MAth.random and to use 
> https://github.com/davidbau/seedrandom/ to seed Math.random.  So, the 
> issues mentioned earlier should be resolved.
>
>
> On Tuesday, February 20, 2018 at 7:40:02 AM UTC-5, Stephan Hradek wrote:
>>
>>
>>
>> Am Dienstag, 20. Februar 2018 13:37:54 UTC+1 schrieb Matthew Lauber:
>>>
>>> Dang!  I go to sleep for 8 hour and your guys pick apart my code.  
>>> Seriously though, thanks guys.  I'll take a look at improving the 
>>> randomness of my shuffle operator.  I seem to recall not using the 
>>> javascript math.random function because I wanted to be able to seed the 
>>> function and get a list ordering that only changed when I clicked a 
>>> button.  I'll see what I can find for that.  
>>>
>>
>> If you want something seedable, checkout 
>> davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/871efee3-4ace-498f-a6b8-1acda3aec9d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Matthew Lauber
I've reworked the shuffle operator to use MAth.random and to use 
https://github.com/davidbau/seedrandom/ to seed Math.random.  So, the 
issues mentioned earlier should be resolved.


On Tuesday, February 20, 2018 at 7:40:02 AM UTC-5, Stephan Hradek wrote:
>
>
>
> Am Dienstag, 20. Februar 2018 13:37:54 UTC+1 schrieb Matthew Lauber:
>>
>> Dang!  I go to sleep for 8 hour and your guys pick apart my code.  
>> Seriously though, thanks guys.  I'll take a look at improving the 
>> randomness of my shuffle operator.  I seem to recall not using the 
>> javascript math.random function because I wanted to be able to seed the 
>> function and get a list ordering that only changed when I clicked a 
>> button.  I'll see what I can find for that.  
>>
>
> If you want something seedable, checkout 
> davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b83f8fb8-ae29-4959-8216-df3cc9437ca5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Stephan Hradek


Am Dienstag, 20. Februar 2018 13:37:54 UTC+1 schrieb Matthew Lauber:
>
> Dang!  I go to sleep for 8 hour and your guys pick apart my code.  
> Seriously though, thanks guys.  I'll take a look at improving the 
> randomness of my shuffle operator.  I seem to recall not using the 
> javascript math.random function because I wanted to be able to seed the 
> function and get a list ordering that only changed when I clicked a 
> button.  I'll see what I can find for that.  
>

If you want something seedable, checkout 
davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html 

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ee553bd2-41f4-481a-8923-093fdc1dc57c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Matthew Lauber
Dang!  I go to sleep for 8 hour and your guys pick apart my code.  
Seriously though, thanks guys.  I'll take a look at improving the 
randomness of my shuffle operator.  I seem to recall not using the 
javascript math.random function because I wanted to be able to seed the 
function and get a list ordering that only changed when I clicked a 
button.  I'll see what I can find for that.  

On Tuesday, February 20, 2018 at 7:25:30 AM UTC-5, Stephan Hradek wrote:
>
>
>
> Am Dienstag, 20. Februar 2018 09:00:13 UTC+1 schrieb passingby:
>>
>> But i am seeing that it repeats one or two tiddler a lot. At first i 
>> thought maybe my tiddlers were not enough in numbers but then i have around 
>> 25 tiddlers and it still repeats a couple initial tiddlers it picks up, a 
>> lot.
>
>
> Please see issue #2 https://github.com/mklauber/tiddly-shuffle/issues/2 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5b3cdf07-54f7-4ddc-a3f6-51dd15a137f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Stephan Hradek


Am Dienstag, 20. Februar 2018 09:00:13 UTC+1 schrieb passingby:
>
> But i am seeing that it repeats one or two tiddler a lot. At first i 
> thought maybe my tiddlers were not enough in numbers but then i have around 
> 25 tiddlers and it still repeats a couple initial tiddlers it picks up, a 
> lot.


Please see issue #2 https://github.com/mklauber/tiddly-shuffle/issues/2 

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5a3beaf2-de62-4024-a65b-4506665e9e55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Stephan Hradek
Hooray! Issue #1 is mine ;) 
https://github.com/mklauber/tiddly-shuffle/issues/1

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4ec21add-5f80-4f9f-a8a9-e2136613be3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Stephan Hradek
Update: Upon inspecting the code a bit more: seed cannot be a multiple of 
pi + pi/2 as it's always a 32 bit integer.

Still I think randomness of |sin| isn't the best.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/03b03d3c-f3b4-43d0-a7ac-c4af8d33b442%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread Stephan Hradek
I think there is a big flaw in Matthew's code.

Instead of using a real random function there is this code:

Math.floor(Math.abs(Math.sin(seed++)) * currentIndex);

There are 2 flaws here I think:
1. sin isn't very "random"
2. sin goes from 0 to 1. This will lead to a just shuffled element being 
shuffled a second time. Even worse it can lead to array index out of bounds 
if the seed is (n * pi)+(pi/2). Try it with seed= 3.14159265359/2 ;)

will open an issue on github

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e5210bfe-82b6-4c5f-92aa-01d3590b1db9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-20 Thread passingby
Matthew
I tried the plugin. Its a wonderful code in that it is not a macro but a filter 
operator, which is very interesting!

And it does work as intended. But i am seeing that it repeats one or two 
tiddler a lot. At first i thought maybe my tiddlers were not enough in numbers 
but then i have around 25 tiddlers and it still repeats a couple initial 
tiddlers it picks up, a lot.

Could you suggest anything for this?

Thank you for your code.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6a3aa0b0-5403-44ec-ade8-7c2b7de0a206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-19 Thread passingby
Thank you Matthew. This would work well.

On Monday, February 19, 2018 at 8:16:34 PM UTC-7, Matthew Lauber wrote:
>
>
>1. Go to https://mklauber.github.io/tw5-plugins/ in one window, open 
>your wiki in another.  
>2. Drag the link "Matt's Plugin Library" to your wiki.  
>3. Then click the Cog to get to settings, and go to the plugins tab.  
>Click "Get More Plugins"
>4. Click "Open Plugin Library" below "Matt's Plugin Library"
>5. look for the plugin with "Shuffle filter operator" in the 
>description and click install.  
>6. Reload your wiki.  It should work now.
>
>
> On Monday, February 19, 2018 at 9:52:50 PM UTC-5, Diego Mesa wrote:
>>
>> Hey Mathew,
>>
>> How can you install the shuffle operator? 
>>
>> Diego 
>>
>> On Monday, February 19, 2018 at 8:46:48 PM UTC-6, Matthew Lauber wrote:
>>>
>>> I've written a shuffle operator that can randomize the order of a list.  
>>> It's available here:  https://mklauber.github.io/tw5-plugins/
>>>
>>> To use it in that way, you'd probably want something along the lines of 
>>>
>>> <$button>
>>> <$list filter="[tag[Tag]shuffle[]first[]]">
>>> <$action-navigate $to=<> />
>>> 
>>> Open
>>> 
>>>
>>> On Monday, February 19, 2018 at 9:10:23 PM UTC-5, passingby wrote:

 Can anybody suggest a way to have a button which opens a random tiddler 
 out of all the tiddlers tagged with a particular tag?

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8f2b06ef-a020-4b8c-a8c9-8603e9bf491e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-19 Thread Matthew Lauber

   
   1. Go to https://mklauber.github.io/tw5-plugins/ in one window, open 
   your wiki in another.  
   2. Drag the link "Matt's Plugin Library" to your wiki.  
   3. Then click the Cog to get to settings, and go to the plugins tab.  
   Click "Get More Plugins"
   4. Click "Open Plugin Library" below "Matt's Plugin Library"
   5. look for the plugin with "Shuffle filter operator" in the description 
   and click install.  
   6. Reload your wiki.  It should work now.


On Monday, February 19, 2018 at 9:52:50 PM UTC-5, Diego Mesa wrote:
>
> Hey Mathew,
>
> How can you install the shuffle operator? 
>
> Diego 
>
> On Monday, February 19, 2018 at 8:46:48 PM UTC-6, Matthew Lauber wrote:
>>
>> I've written a shuffle operator that can randomize the order of a list.  
>> It's available here:  https://mklauber.github.io/tw5-plugins/
>>
>> To use it in that way, you'd probably want something along the lines of 
>>
>> <$button>
>> <$list filter="[tag[Tag]shuffle[]first[]]">
>> <$action-navigate $to=<> />
>> 
>> Open
>> 
>>
>> On Monday, February 19, 2018 at 9:10:23 PM UTC-5, passingby wrote:
>>>
>>> Can anybody suggest a way to have a button which opens a random tiddler 
>>> out of all the tiddlers tagged with a particular tag?
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/650ebc91-709f-4bca-bf7b-2ffd4fc72c26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-19 Thread Diego Mesa
Hey Mathew,

How can you install the shuffle operator? 

Diego 

On Monday, February 19, 2018 at 8:46:48 PM UTC-6, Matthew Lauber wrote:
>
> I've written a shuffle operator that can randomize the order of a list.  
> It's available here:  https://mklauber.github.io/tw5-plugins/
>
> To use it in that way, you'd probably want something along the lines of 
>
> <$button>
> <$list filter="[tag[Tag]shuffle[]first[]]">
> <$action-navigate $to=<> />
> 
> Open
> 
>
> On Monday, February 19, 2018 at 9:10:23 PM UTC-5, passingby wrote:
>>
>> Can anybody suggest a way to have a button which opens a random tiddler 
>> out of all the tiddlers tagged with a particular tag?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fcb0dc25-9fc2-41b2-9559-fe5d0c7c581c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: A button to open a random tiddler

2018-02-19 Thread Matthew Lauber
I've written a shuffle operator that can randomize the order of a list.  
It's available here:  https://mklauber.github.io/tw5-plugins/

To use it in that way, you'd probably want something along the lines of 

<$button>
<$list filter="[tag[Tag]shuffle[]first[]]">
<$action-navigate $to=<> />

Open


On Monday, February 19, 2018 at 9:10:23 PM UTC-5, passingby wrote:
>
> Can anybody suggest a way to have a button which opens a random tiddler 
> out of all the tiddlers tagged with a particular tag?
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/81951958-38cb-4c19-b520-4f1d9f1e258d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.