Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

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.

Identifying the maximum value of an array

Featured Replies

I use a pseudo random number generator to generate 6 random numbers and then assign these values to L:Random1 through L:Random6. Question - how do I then efficiently determine which value is the highest?To be a little more specific, I am trying to return the index number of the highest value rather than the highest random number itself.Thanks in advance for any suggestions.Bob

Maybe try -(L:Random1,number) (L:Random2,number) max (L:Random3,number) max (L:Random4,number) max (L:Random5,number) max (L:Random6,number) max (>L:MaxNumber, number)(L:MaxNumber,number) (L:Random1,number) == if{ 1 (>L:Index,number) }(L:MaxNumber,number) (L:Random2,number) == if{ 2 (>L:Index,number) }(L:MaxNumber,number) (L:Random3,number) == if{ 3 (>L:Index,number) }(L:MaxNumber,number) (L:Random4,number) == if{ 4 (>L:Index,number) }(L:MaxNumber,number) (L:Random5,number) == if{ 5 (>L:Index,number) }(L:MaxNumber,number) (L:Random6,number) == if{ 6 (>L:Index,number) }Cannot test this, just an idea, hope it may help.Roman

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

  • Author
Maybe try -(L:Random1,number) (L:Random2,number) max (L:Random3,number) max (L:Random4,number) max (L:Random5,number) max (L:Random6,number) max (>L:MaxNumber, number)(L:MaxNumber,number) (L:Random1,number) == if{ 1 (>L:Index,number) }(L:MaxNumber,number) (L:Random2,number) == if{ 2 (>L:Index,number) }(L:MaxNumber,number) (L:Random3,number) == if{ 3 (>L:Index,number) }(L:MaxNumber,number) (L:Random4,number) == if{ 4 (>L:Index,number) }(L:MaxNumber,number) (L:Random5,number) == if{ 5 (>L:Index,number) }(L:MaxNumber,number) (L:Random6,number) == if{ 6 (>L:Index,number) }Cannot test this, just an idea, hope it may help.Roman
Yes, this works. It seems so obvious now, thanks to you! Much appreciated.

Create an account or sign in to comment

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.