Skip to content
View in the app

A better way to browse. Learn more.

Opusmodus

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Probability in random functions

Featured Replies

Greetings:

 

Working with the probability weighting control in random functions displays that they may be some value in revisiting the code to see if there may be a way to improve it.

What I am seeing:

 

(setf instr2 (flatten (rnd-unique n-bars pats2 :prob 0.89)))

Here "pats2" is a field of 32 values from 1 to 32. "n-bars" is 11 in this case.

 

A return of this function:

(26 27 16 19 31 17 20 29 24 6 5)

With the weighting of 0.89, I do not expect to see 6 or 5 in the result. In fact, with a higher number, such as 0.9, low numbers are returned often, but the result "should" be from only the higher numbers?

 

If one sets the weighting to 1.0, there is another kind of anomaly in the output:

 

OM 361 > rnd-unique :seed 138124
flatten
(32 31 30 29 28 27 26 25 24 23 22)

OM 362 > rnd-unique :seed 856981
flatten
(32 31 30 29 28 27 26 25 24 23 22)

 

Likewise setting the value to 0.0 results in the opposite result.

 

My intuition suggests that this may have to do with two factors: 1) the nature of the rnd-unique function itself - only selecting UNIQUE elements (no repeated values) and 2) the relatively small domain of the possible (32 in this case) combined with the number of results (11 in this case).  However, I am not sure.

 

I hope that these comments are helpful.

 

Create an account or sign in to comment


Copyright © 2014-2026 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.