Post Reply 
ChatGPT for programming
03-30-2023, 09:23 AM (This post was last modified: 03-30-2023 09:25 AM by Roberto Volpi.)
Post: #13
RE: ChatGPT for programming
(03-30-2023 09:09 AM)pier4r Wrote:  Thank you valentin! Nice point TallKey.

I also asked a little questions.

Quote:I want to make a function - pseudocode - that picks randomly between the numbers 0 to 7 and 20 to 23. How would you do it?

Here's an example pseudocode function that randomly picks a number between 0 to 7 and 20 to 23:

Code:
function random_number():
    // Generate a random integer between 0 and 1
    random_bit = random_integer(0, 1)
    
    // If the random bit is 0, pick a random integer between 0 and 7
    if random_bit == 0:
        return random_integer(0, 7)
    
    // If the random bit is 1, pick a random integer between 20 and 23
    else:
        return random_integer(20, 23)

...further explanations...


I'd like an uniform distribution and that what you suggest, although working, is not uniform.

I apologize for the confusion. You're right that the previous approach I suggested doesn't result in a uniform distribution, as it will pick numbers from the two ranges with equal probability but not uniformly within each range.

Here's a revised pseudocode function that should pick a random number uniformly from the given ranges:

Code:
function random_number():
    // Pick a random number from one of the two ranges with equal probability
    range_bit = random_integer(0, 1)
    
    // If the range_bit is 0, pick a random number between 0 and 7 inclusive
    if range_bit == 0:
        return random_integer(0, 7)
    
    // Otherwise, pick a random number between 20 and 23 inclusive
    else:
        return random_integer(20, 23)

Then it continues even if I say that the chat identified the problem but didn't solve it in the implementation. The interesting part is that the Issue is indeed recognized.

Identifying a problem (whatever it means) is not a great achievement.

It is important to take into account that ChatGTP is, in a nutshell, a probabilist model to chain words, which meaning is given by the reader.

It remember me of a monkey that has been taught with signs language: the monkey can learn sooner or later to master those signs meaning “give me a banana” or similar, but that’s it.



Put a calculator into your life!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
ChatGPT for programming - hpmin48gx - 03-29-2023, 12:27 AM
RE: ChatGPT for programming - carey - 03-29-2023, 02:25 PM
RE: ChatGPT for programming - carey - 03-29-2023, 03:58 PM
RE: ChatGPT for programming - pier4r - 03-29-2023, 08:28 PM
RE: ChatGPT for programming - pier4r - 03-29-2023, 08:42 PM
RE: ChatGPT for programming - TallKey - 03-30-2023, 12:37 AM
RE: ChatGPT for programming - lrdheat - 03-30-2023, 01:19 AM
RE: ChatGPT for programming - pier4r - 03-30-2023, 09:09 AM
RE: ChatGPT for programming - Roberto Volpi - 03-30-2023 09:23 AM
RE: ChatGPT for programming - pier4r - 03-30-2023, 09:32 AM
RE: ChatGPT for programming - pier4r - 03-31-2023, 09:49 AM
RE: ChatGPT for programming - Paul Dale - 03-31-2023, 03:49 AM
RE: ChatGPT for programming - pier4r - 03-31-2023, 12:34 PM
RE: ChatGPT for programming - pier4r - 03-31-2023, 02:03 PM
RE: ChatGPT for programming - carey - 04-01-2023, 07:23 AM
RE: ChatGPT for programming - pier4r - 04-01-2023, 06:15 PM
RE: ChatGPT for programming - pier4r - 04-01-2023, 08:58 PM
RE: ChatGPT for programming - pier4r - 04-01-2023, 09:42 PM
RE: ChatGPT for programming - mfleming - 04-01-2023, 11:13 AM
RE: ChatGPT for programming - pier4r - 05-16-2023, 07:45 PM



User(s) browsing this thread: 2 Guest(s)