Page 2 of 2 FirstFirst 12
Results 41 to 52 of 52

Thread: Is RND biased?

  1. #41

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: I can't figure it out.

    Quote Originally Posted by yereverluvinuncleber View Post
    Please use better titles to your posts.
    ok. I'll do better.

  2. #42

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: I can't figure it out.

    Quote Originally Posted by OptionBase1 View Post
    Post _ALL_ the code and maybe we can find it.
    I'm on the verge of something huge that I plan to market - photorealistic sound. I'm not giving that away.

  3. #43
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,273

    Re: I can't figure it out.

    Quote Originally Posted by cafeenman View Post
    I'm on the verge of something huge that I plan to market - photorealistic sound. I'm not giving that away.
    What is the ratio of McGuffins to Hertz? Is it the same as the ratio of leprechauns to unicorns?

  4. #44

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: Is RND biased?

    OK, this may give away the game, but you have to calculate hertz/pounds for the torque collector then divide that by the screen aspect ratio which is modified by the wing-loading.

    It's basic math but putting it together right takes a lot or r & d.

  5. #45
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,607

    Re: Is RND biased?

    Quote Originally Posted by cafeenman View Post
    OK, this may give away the game, but you have to calculate hertz/pounds for the torque collector then divide that by the screen aspect ratio which is modified by the wing-loading.
    You can do that all you want, but it ain't gonna fly. You gotta go metric to make it work - and it's hertz/km you need for the torque collector, other wise you're just spinning your wheels.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #46

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: Is RND biased?

    As I said, I'm on the verge of something really big that will turn all conventional thought upside down. I left out the real ingredient - the mean hydrodynamic chord.

    Now I've just destroyed my entire future by giving away the secret.

    I hope my cats forgive me.

  7. #47

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: Is RND biased?

    Being serious for a minute, this is an example of a sub that I believe is totally even that differs slightly from the others. This is one of those coin-flip subs I mentioned earlier (the nonsense discussion above reminded me of the discoencabulator).

    Code:
    Private Sub ReturnToHomeBase()
    Dim m_CallStacker As New cCallStacker
    Static nReturnToBase(1 To 3) As Long
    Dim nRnd As Long
    
    m_CallStacker.Add NAME & ".ReturnToHomeBase(Private Sub)"
    
    AddPlayerMessage AddAsterisks("You return to Home Base to rest for 8 Hours.")
    
    nRnd = RollDie(d3)
    
    nReturnToBase(nRnd) = nReturnToBase(nRnd) + 1
    
    Select Case nRnd
    
      Case 1
    
        AddPlayerMessage AddAsterisks("You decoupled the turboencabulator right in front of your whole family at dinner."), 2000
    
        mw_Player.AddAttributePoints idx_Player_Attribute_Energy, idx_Damage
    
      Case 2
    
        AddPlayerMessage AddAsterisks("You correctly coupled the retroencabulator in front of your whole family at dinner!"), 2000
    
        mw_Player.AddAttributePoints idx_Player_Attribute_Energy, idx_Buff
    
      Case 3
    
        AddPlayerMessage AddAsterisks("You accidentally activated the discoencabulator in front of your whole family at dinner!"), 2000
        AddPlayerMessage vbCrLf & vbTab & "Your whole family danced together and had the time of their lives.", 1000
    
        mw_Player.AddAttributePoints RandomAttributeID, idx_Buff
    
        AddPlayerMessage vbCrLf & vbTab & "... until Grandma broke her hip.", 2000
    
        mw_Player.AddAttributePoints RandomAttributeID, idx_Damage
    
    End Select
    
    ShowChoiceCount "nReturnToBase", nReturnToBase
    
    End Sub

  8. #48

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: Is RND biased?

    Code:
    ' Declarations
    
    Public Enum PLAYER_ATTRIBUTES
    
      idx_Player_Attribute_Braintrust = 0      ' B - Braintrust (Formerly Tech Savvy)
      idx_Player_Attribute_Readiness           ' R - Readiness (Formerly Situational Awareness)
      idx_Player_Attribute_IntestinalFortitude ' I - Intestinal Fortitude
      idx_Player_Attribute_Cheer               ' C - Cheer (Formerly Joy Sparks)
      idx_Player_Attribute_Karma               ' K - Karma (Formerly Fate)
    
      idx_Player_Attribute_Energy              ' E - Energy (Formerly Health Points)
      idx_Player_Attribute_Advancements        ' A - Advancements (Formerly Tech Points)
    
    End Enum
    
    Public Const MIN_PLAYER_ATTRIBUTE As Long = idx_Player_Attribute_Braintrust
    Public Const MAX_PLAYER_ATTRIBUTE As Long = idx_Player_Attribute_Advancements
    
    
    Public Function RandomAttributeID() As PLAYER_ATTRIBUTES
    Dim m_CallStacker As New cCallStacker
    
    m_CallStacker.Add NAME & ".RandomAttributeID(Public Function)"
    
    RandomAttributeID = RollDie(MAX_PLAYER_ATTRIBUTE + 1) - 1
    
    End Function

  9. #49
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,264

    Re: Is RND biased?

    Quote Originally Posted by cafeenman View Post
    As I said, I'm on the verge of something really big that will turn all conventional thought upside down.
    Doing that would turn some people right side up.
    My usual boring signature: Nothing

  10. #50
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,091

    Re: Is RND biased?

    You mentioned in one of your posts in one of your thread that would like to resume a session from a fixed starting point the Rnd value list.
    I created a small sample which is capable of doing this:

    Code in a module:
    Code:
    Option Explicit
    
    Private m_lCalls As Long
    Private m_lSeed As Long
    
    Public Sub RNDInit(ByVal lSeed As Long)
      m_lCalls = 0
      m_lSeed = lSeed
      If m_lSeed = 0 Then m_lSeed = 100 * Timer
      Rnd -1
      Randomize Abs(m_lSeed)
    End Sub
    
    ' generates a random value between min and max
    Public Function RNDVal(ByVal lMin As Long, ByVal lMax As Long, Optional ByVal lIteration As Long = -1) As Long
      Dim i As Long
      
      If lIteration <> -1 Then
        RNDInit m_lSeed
        For i = 1 To lIteration - 1: Rnd: Next
        m_lCalls = lIteration - 1
      End If
      
      RNDVal = Int((lMax - lMin + 1) * Rnd + lMin)
      m_lCalls = m_lCalls + 1
    End Function
    To test in a Form with 2 command buttons:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      RNDInit 12345
    End Sub
    
    Private Sub Command1_Click()
      Debug.Print RNDVal(0, 255)
    End Sub
    
    Private Sub Command2_Click()
      Debug.Print "Item 4", RNDVal(0, 255, 4)
    End Sub

  11. #51

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: Is RND biased?

    Current state of the game. I have a new monitor (old one got a lot of burn-in and was drawing a ton of amps) so have to reboot. I wanted a screenshot before I ended the app.

    Numbers are pretty good regarding distribution. I think they're all within spec of being equally, randomly selected.

    But the Reputation bar is skewed way positive. It's the Green line right below the stats. It should stay dead center as it is simply a count of Instances, not points.

    It has a max of 1000 a min of 0 and it starts at 500.

    So one good thing adds one Rep. One bad thing takes away one Rep. It's at-a-glance if the instances are evenly distributed or not.


  12. #52

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,665

    Re: Is RND biased?

    Quote Originally Posted by Arnoutdv View Post
    You mentioned in one of your posts in one of your thread that would like to resume a session from a fixed starting point the Rnd value list.
    I created a small sample which is capable of doing this:

    Code in a module:
    Code:
    Option Explicit
    
    Private m_lCalls As Long
    Private m_lSeed As Long
    
    Public Sub RNDInit(ByVal lSeed As Long)
      m_lCalls = 0
      m_lSeed = lSeed
      If m_lSeed = 0 Then m_lSeed = 100 * Timer
      Rnd -1
      Randomize Abs(m_lSeed)
    End Sub
    
    ' generates a random value between min and max
    Public Function RNDVal(ByVal lMin As Long, ByVal lMax As Long, Optional ByVal lIteration As Long = -1) As Long
      Dim i As Long
      
      If lIteration <> -1 Then
        RNDInit m_lSeed
        For i = 1 To lIteration - 1: Rnd: Next
        m_lCalls = lIteration - 1
      End If
      
      RNDVal = Int((lMax - lMin + 1) * Rnd + lMin)
      m_lCalls = m_lCalls + 1
    End Function
    To test in a Form with 2 command buttons:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      RNDInit 12345
    End Sub
    
    Private Sub Command1_Click()
      Debug.Print RNDVal(0, 255)
    End Sub
    
    Private Sub Command2_Click()
      Debug.Print "Item 4", RNDVal(0, 255, 4)
    End Sub
    OK, so I think I misunderstood what you're telling me and I apologize for that.

    For your thing to work I would need to save every time I used rnd, right?

    I don't think I said that I wanted to save that state of the game (random-wise) though. I don't want to do that. I would like to be able to save the game stats and reload that and the rnd would just get reinitialized.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width