This is deterministic but IS NOT a real number! albeit it works for many
purposes like display a random quote at TW startup
or display a random content when a tiddler is shown!


Best wishes
Mohammad


On Wed, Sep 11, 2019 at 11:30 PM Mohammad Rahmani <
[email protected]> wrote:

> Mat,
>  Do you mean something like this
>
> \define pseudo-rand(beta, alpha:1)
> <$set name=seed value=<<now "XXX">> >
> <$list
> filter="[<__beta__>subtract<__alpha__>multiply<seed>divide[999]add<__alpha__>round[]]"
> variable=prand>
> <<prand>>
> </$list>
> </$set>
> \end
>
>
> <<pseudo-rand beta:10>>
>
> If we linearly map [0, 999] into [alpha:1, beta:n] where alpha is the
> first tiddler and beta is the number of tiddlers to be used for random
> display!
> from mathematics we have
>
> x in [0, 999] (this will be generated by now macro)
> y in [alpha, beta] (this is the number we like)
>
> then y= (beta - alpha) / 999  + alpha
>
> In our case if assume number of tiddlers tagged say with myTag is n like
> 100 then
>
> <<pseudo-rand beta:100>>
>
> n can be calculated values for example from count filter operator.
>
>
>
>
> Best wishes
> Mohammad
>
>
> On Wed, Sep 11, 2019 at 10:50 PM Mat <[email protected]> wrote:
>
>> Seems you've solved your needs but I'd think
>>
>> <<now "xxx">>
>>
>> should probably be enough in many cases. It's more or less a random
>> number between 0 and 999.
>>
>> If we had a modulo operator I think it should be simple to convert it to
>> a random number in any other range. I tried to extract the last digit but a
>> few quick attempts failed - suggestions anyone?
>>
>> <:-)
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/9a97a046-3e7a-4718-afea-8c4a7a8a697a%40googlegroups.com
>> <https://groups.google.com/d/msgid/tiddlywiki/9a97a046-3e7a-4718-afea-8c4a7a8a697a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMBt9Uo_9bVHtqDFkqEQFN8bx7dDk_Fg0b4d7ynjvEXB8g%40mail.gmail.com.

Reply via email to