Generating random uniform numbers

34 views
Skip to first unread message

Amit Deshwar

unread,
Apr 10, 2020, 6:31:45 PM4/10/20
to Kona Users
Hello!

I'm trying to generate random uniform numbers but can't seem to find this functionality built in.  I've searched the mailing list and saw that previously people were using ? but it seems like the behavior has changed.  So far I'm drawing an integer from a large value and then dividing by the floating point version of that large value but it's a pretty ugly solution.

Thanks,
Amit

Tom Szczesny

unread,
Apr 11, 2020, 12:09:44 PM4/11/20
to kona...@googlegroups.com
Hi Amit --

See page 211 of the K 2.0 reference manual.
You can find the reference manual in the kona wiki under "Links".

Draw
x _draw y
Description:   Make x random selections from !y with replacement if y is positive, from !-y without replacement if y is negative, or from the interval (0,1) if y is 0.

example:
  9 _draw 0
0.3432165 0.6135203 0.4166627 0.4891965 0.6803496 0.1486358 0.694014 0.4633182 0.1783197

Best,
Tom



--
You received this message because you are subscribed to the Google Groups "Kona Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kona-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kona-user/ceac3f6b-f364-4f2f-901e-abd6949e37a1%40googlegroups.com.

Amit Deshwar

unread,
Apr 11, 2020, 2:41:56 PM4/11/20
to kona...@googlegroups.com
Thanks Tom!

You received this message because you are subscribed to a topic in the Google Groups "Kona Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kona-user/WOGpnm9xon0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kona-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kona-user/CABn7SNYRB4_jyuTck43ngoUi3yPSvfjthJYQBoF67E784A3ibA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages