random

I cant verify seed generation if someone can see what is wrong

I cant verify seed generation if someone can see what is wrong Question: So i got this function that generates seeds makeseed() and now im trying to make a "verify" seed keep in mind that any seed generated IS Correct so i want it so that the user can input seeds and it’ll check if …

Total answers: 1

TypeError: invalid rect assignment with vectors

TypeError: invalid rect assignment with vectors Question: I am a novice to programming and wanted to make pong as one of my first projects. I am now trying to get the pong ball to bounce to a random location but i got a TypeError: invalid rect assignement. Here is my code: import pygame import os …

Total answers: 1

Values disappear after using button in streamlit

Values disappear after using button in streamlit Question: I am trying to write an application to play Wheel of Fortune. Once I draw a password and want to e.g. draw points the password disappears. I know that this is caused by refreshing the application after pressing another button, but I do not know how to …

Total answers: 1

Generating random square wave that last for certain time

Generating random square wave that last for certain time Question: I am trying to generate a random square wave signal in Python that lasts for a certain amount of time. Specifically,each square wave should have a fixed duration of 5 minutes and a random amplitude that is bounded between 0 and 1. The square wave …

Total answers: 2

Rock Paper Scissors game gone wrong. Random function Error

Rock Paper Scissors game gone wrong. Random function Error Question: I am writing code for a rock paper scissors game, and when i start writing computer choice with the random function, I get this: TypeError: randint() missing 1 required positional argument: ‘b’ Here’s the code: import random ai_choice = random.randint([0, 2]) if int(ai_choice) == 0: …

Total answers: 3

Is this code capable of generating Cryptographically Secure Pseudo-Random Number Generator

Is this code capable of generating Cryptographically Secure Pseudo-Random Number Generator Question: I have a piece of code which generates a string of length 50 to 100 with random characters the code is : CharLIST = list(‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890’) def NEW(id_len): _id = ” while len(_id) < id_len: _id += random.choice(CharLIST) return _id NEW(random.randint(50, 100)) I expect …

Total answers: 2

While loop not executing passed the user input

While loop not executing passed the user input Question: #imports a library to call on random integers import random user_choice = ” random_num1 = 0 random_num2 = 0 random_num3 = 0 #keeps the loop going until ended by the user while user_choice != "n": user_choice = input(f’Welcome to the slot machine, would you like to …

Total answers: 1

How to make a random function without using any library?

How to make a random function without using any library? Question: I know that the way to produce random numbers from 0 to 1 (0.0 ≤ n < 1.0) can be done using a code like this in Python: import random print(random.random()) But I’m curious about how this function can be made and how it …

Total answers: 1